[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - loleaflet/js

merttumer (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 12:28:23 UTC 2019


 loleaflet/js/toolbar.js |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 8851fd58bcaffa080501f157b348d6748a1ff005
Author:     merttumer <mert.tumer at collabora.com>
AuthorDate: Mon Aug 26 14:12:08 2019 +0300
Commit:     Aron Budea <aron.budea at collabora.com>
CommitDate: Wed Oct 9 14:28:05 2019 +0200

    tdf#126205: Fix file format conversion on rename input
    
    Change-Id: I342ed309dfc116389f91886f5e1fd7b6c49178ed
    Signed-off-by: merttumer <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/80097
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index e990b5a80..b5dc4cfb1 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1332,12 +1332,20 @@ function documentNameConfirm() {
 	var value = $('#document-name-input').val();
 	if (value !== null && value != '' && value != map['wopi'].BaseFileName) {
 		if (map['wopi'].UserCanRename && map['wopi'].SupportsRename) {
-			// file name must be without the extension
-			if (value.lastIndexOf('.') > 0)
-				value = value.substr(0, value.lastIndexOf('.'));
-			
-			map.sendUnoCommand('.uno:Save');
-			map._RenameFile = value;
+			if (value.lastIndexOf('.') > 0) {
+				var fname = map['wopi'].BaseFileName;
+				var ext =  fname.substr(fname.lastIndexOf('.')+1, fname.length);
+				// check format conversion
+				if (ext != value.substr(value.lastIndexOf('.')+1, value.length)) {
+					map.saveAs(value);
+				} else {
+					// same extension, just rename the file
+					// file name must be without the extension for rename
+					value = value.substr(0, value.lastIndexOf('.'));
+					map.sendUnoCommand('.uno:Save');
+					map._RenameFile = value;
+				}
+			}
 		} else {
 			// saveAs for rename
 			map.saveAs(value);


More information about the Libreoffice-commits mailing list