Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4491 from TomMalbran/tom/issue-4453
Browse files Browse the repository at this point in the history
Issue #4453: Parameter "{0}" appears in the invalid filename title.
  • Loading branch information
jasonsanjose committed Jul 17, 2013
2 parents 9001e6e + 4d3d6ce commit 22959e4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1098,18 +1098,20 @@ define(function (require, exports, module) {

/**
* @private
*
* Check a filename for illegal characters. If any are found, show an error
* dialog and return false. If no illegal characters are found, return true.
* @param {string} filename
* @param {boolean} isFolder
* @return {boolean} Returns true if no illegal characters are found
*/
function _checkForValidFilename(filename) {
function _checkForValidFilename(filename, isFolder) {
// Validate file name
// Checks for valid Windows filenames:
// See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
if ((filename.search(/[\/?*:;\{\}<>\\|]+/) !== -1) || filename.match(_illegalFilenamesRegEx)) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.INVALID_FILENAME_TITLE,
StringUtils.format(Strings.INVALID_FILENAME_TITLE, isFolder ? Strings.DIRECTORY : Strings.FILE),
Strings.INVALID_FILENAME_MESSAGE
);
return false;
Expand Down Expand Up @@ -1194,7 +1196,7 @@ define(function (require, exports, module) {

if (!escapeKeyPressed) {
// Validate file name
if (!_checkForValidFilename(data.rslt.name)) {
if (!_checkForValidFilename(data.rslt.name, isFolder)) {
errorCleanup();
return;
}
Expand Down Expand Up @@ -1418,7 +1420,7 @@ define(function (require, exports, module) {
_projectTree.jstree("sort", selected.parent());
};

if (!changed || !_checkForValidFilename(data.rslt.new_name)) {
if (!changed || !_checkForValidFilename(data.rslt.new_name, isFolder)) {
// No change or invalid filename. Reset the old name and bail.
_resetOldFilename();
return;
Expand Down

0 comments on commit 22959e4

Please sign in to comment.