[Libreoffice-commits] online.git: loleaflet/src

merttumer (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 4 20:23:18 UTC 2019


 loleaflet/src/control/Control.Toolbar.js |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit efdc5dbc0894edbb3c3bfa1dc61dedaf0ee26a8e
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: Fri Oct 4 22:23:00 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/80137
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>

diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 3c96c905a..3e6a970cb 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -1190,12 +1190,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