From 7a11ecd7d73556cc62750ced640db247c30ea59d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 25 Nov 2022 14:43:19 +0300 Subject: [PATCH] Fix Bug 59766 --- apps/spreadsheeteditor/main/app/view/Statusbar.js | 7 +++---- apps/spreadsheeteditor/main/locale/en.json | 2 +- apps/spreadsheeteditor/mobile/locale/en.json | 2 +- apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/Statusbar.js b/apps/spreadsheeteditor/main/app/view/Statusbar.js index 431bb844c..8a013f483 100644 --- a/apps/spreadsheeteditor/main/app/view/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/view/Statusbar.js @@ -1091,7 +1091,7 @@ define([ this.txtName = new Common.UI.InputField({ el: $window.find('#txt-sheet-name'), style: 'width:100%;', - value: Common.Utils.String.htmlEncode(this.options.current), + value: this.options.current, allowBlank: false, maxLength: 31, validation: _.bind(this.nameValidator, this) @@ -1155,14 +1155,13 @@ define([ } } - if (value.length > 2 && value[0]=='"' && value[value.length-1]=='"') return true; - if (!/[:\\\/\*\?\[\]\']/.test(value)) return true; + if (!/^(\')|[:\\\/\*\?\[\]]|(\')$/.test(value)) return true; return this.errNameWrongChar; }, errNameExists : 'Worksheet with such name already exist.', - errNameWrongChar: 'A sheet name cannot contains characters: \\, \/, *, ?, [, ], :', + errNameWrongChar: 'A sheet name cannot contains characters: \\, \/, *, ?, [, ], : or the character \' as first or last character', labelSheetName : 'Sheet Name' }, RenameDialog||{})); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index bb419af66..d56275437 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -3461,7 +3461,7 @@ "SSE.Views.Statusbar.itemTabColor": "Tab Color", "SSE.Views.Statusbar.itemUnProtect": "Unprotect", "SSE.Views.Statusbar.RenameDialog.errNameExists": "Worksheet with such a name already exists.", - "SSE.Views.Statusbar.RenameDialog.errNameWrongChar": "A sheet name cannot contain the following characters: \\/*?[]:", + "SSE.Views.Statusbar.RenameDialog.errNameWrongChar": "A sheet name cannot contain the following characters: \\/*?[]: or the character ' as first or last character", "SSE.Views.Statusbar.RenameDialog.labelSheetName": "Sheet name", "SSE.Views.Statusbar.selectAllSheets": "Select All Sheets", "SSE.Views.Statusbar.sheetIndexText": "Sheet {0} of {1}", diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index af1fb7b0a..79f382a98 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -304,7 +304,7 @@ "textDelete": "Delete", "textDuplicate": "Duplicate", "textErrNameExists": "Worksheet with this name already exists.", - "textErrNameWrongChar": "A sheet name cannot contains characters: \\, /, *, ?, [, ], :", + "textErrNameWrongChar": "A sheet name cannot contains characters: \\, /, *, ?, [, ], : or the character ' as first or last character", "textErrNotEmpty": "Sheet name must not be empty", "textErrorLastSheet": "The workbook must have at least one visible worksheet.", "textErrorRemoveSheet": "Can't delete the worksheet.", diff --git a/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx index 47f114d8f..ab9a63b76 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx @@ -251,7 +251,7 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props => onClick: function () { let s = $$('input[name="modal-sheet-name"]').val(), wc = api.asc_getWorksheetsCount(), items = [], - err = !s.trim().length ? _t.textErrNotEmpty : ((s.length > 2 && s[0] == '"' && s[s.length-1] == '"' || !/[:\\\/\*\?\[\]\']/.test(s)) ? null : _t.textErrNameWrongChar); + err = !s.trim().length ? _t.textErrNotEmpty : ((!/^(\')|[:\\\/\*\?\[\]]|(\')$/.test(s)) ? null : _t.textErrNameWrongChar); if (!err) { while (wc--) { if (sindex !== wc) {