Fix Bug 59766

This commit is contained in:
Julia Radzhabova 2022-11-25 14:43:19 +03:00
parent 9232bcdcac
commit 7a11ecd7d7
4 changed files with 6 additions and 7 deletions

View file

@ -1091,7 +1091,7 @@ define([
this.txtName = new Common.UI.InputField({ this.txtName = new Common.UI.InputField({
el: $window.find('#txt-sheet-name'), el: $window.find('#txt-sheet-name'),
style: 'width:100%;', style: 'width:100%;',
value: Common.Utils.String.htmlEncode(this.options.current), value: this.options.current,
allowBlank: false, allowBlank: false,
maxLength: 31, maxLength: 31,
validation: _.bind(this.nameValidator, this) 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; return this.errNameWrongChar;
}, },
errNameExists : 'Worksheet with such name already exist.', 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' labelSheetName : 'Sheet Name'
}, RenameDialog||{})); }, RenameDialog||{}));

View file

@ -3461,7 +3461,7 @@
"SSE.Views.Statusbar.itemTabColor": "Tab Color", "SSE.Views.Statusbar.itemTabColor": "Tab Color",
"SSE.Views.Statusbar.itemUnProtect": "Unprotect", "SSE.Views.Statusbar.itemUnProtect": "Unprotect",
"SSE.Views.Statusbar.RenameDialog.errNameExists": "Worksheet with such a name already exists.", "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.RenameDialog.labelSheetName": "Sheet name",
"SSE.Views.Statusbar.selectAllSheets": "Select All Sheets", "SSE.Views.Statusbar.selectAllSheets": "Select All Sheets",
"SSE.Views.Statusbar.sheetIndexText": "Sheet {0} of {1}", "SSE.Views.Statusbar.sheetIndexText": "Sheet {0} of {1}",

View file

@ -304,7 +304,7 @@
"textDelete": "Delete", "textDelete": "Delete",
"textDuplicate": "Duplicate", "textDuplicate": "Duplicate",
"textErrNameExists": "Worksheet with this name already exists.", "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", "textErrNotEmpty": "Sheet name must not be empty",
"textErrorLastSheet": "The workbook must have at least one visible worksheet.", "textErrorLastSheet": "The workbook must have at least one visible worksheet.",
"textErrorRemoveSheet": "Can't delete the worksheet.", "textErrorRemoveSheet": "Can't delete the worksheet.",

View file

@ -251,7 +251,7 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props =>
onClick: function () { onClick: function () {
let s = $$('input[name="modal-sheet-name"]').val(), let s = $$('input[name="modal-sheet-name"]').val(),
wc = api.asc_getWorksheetsCount(), items = [], 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) { if (!err) {
while (wc--) { while (wc--) {
if (sindex !== wc) { if (sindex !== wc) {