tdf#126205: Fix file format conversion on rename input
Change-Id: I342ed309dfc116389f91886f5e1fd7b6c49178ed Signed-off-by: merttumer <mert.tumer@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/80137 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com>
This commit is contained in:
parent
e4f2145899
commit
efdc5dbc08
1 changed files with 14 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue