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 #7772 from adobe/jeff/fixFolderDots
Browse files Browse the repository at this point in the history
Disallow file and folder names that end with dots
  • Loading branch information
redmunds committed May 20, 2014
2 parents a0ca546 + 631c7ca commit f3f011a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
11 changes: 8 additions & 3 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ define({
"FILE_EXISTS_ERR" : "The file or directory already exists.",
"FILE" : "file",
"DIRECTORY" : "directory",
"DIRECTORY_NAMES_LEDE" : "Directory names",
"FILENAMES_LEDE" : "Filenames",
"FILENAME" : "filename",
"DIRECTORY_NAME" : "directory name",


// Project error strings
"ERROR_LOADING_PROJECT" : "Error loading project",
Expand All @@ -60,9 +65,9 @@ define({
"ERROR_RENAMING_FILE" : "An error occurred when trying to rename the file <span class='dialog-filename'>{0}</span>. {1}",
"ERROR_DELETING_FILE_TITLE" : "Error deleting file",
"ERROR_DELETING_FILE" : "An error occurred when trying to delete the file <span class='dialog-filename'>{0}</span>. {1}",
"INVALID_FILENAME_TITLE" : "Invalid {0} name",
"INVALID_FILENAME_MESSAGE" : "Filenames cannot contain the following characters: {0} or use any system reserved words.",
"FILE_ALREADY_EXISTS" : "The {0} <span class='dialog-filename'>{1}</span> already exists.",
"INVALID_FILENAME_TITLE" : "Invalid {0}",
"INVALID_FILENAME_MESSAGE" : "{0} cannot use any system reserved words, end with dots (.) or use any of the following characters: <code class='emphasized'>{1}</code>",
"ENTRY_WITH_SAME_NAME_EXISTS" : "A file or directory with the name <span class='dialog-filename'>{0}</span> already exists.",
"ERROR_CREATING_FILE_TITLE" : "Error creating {0}",
"ERROR_CREATING_FILE" : "An error occurred when trying to create the {0} <span class='dialog-filename'>{1}</span>. {2}",

Expand Down
17 changes: 8 additions & 9 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ define(function (require, exports, module) {
* RegEx to validate if a filename is not allowed even if the system allows it.
* This is done to prevent cross-platform issues.
*/
var _illegalFilenamesRegEx = /^(\.+|com[1-9]|lpt[1-9]|nul|con|prn|aux)$/i;

var _illegalFilenamesRegEx = /^(\.+|com[1-9]|lpt[1-9]|nul|con|prn|aux|)$|\.+$/i;

var suppressToggleOpen = false;

Expand Down Expand Up @@ -1529,8 +1530,8 @@ define(function (require, exports, module) {
filename.match(_illegalFilenamesRegEx)) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
StringUtils.format(Strings.INVALID_FILENAME_TITLE, isFolder ? Strings.DIRECTORY : Strings.FILE),
StringUtils.format(Strings.INVALID_FILENAME_MESSAGE, _invalidChars)
StringUtils.format(Strings.INVALID_FILENAME_TITLE, isFolder ? Strings.DIRECTORY_NAME : Strings.FILENAME),
StringUtils.format(Strings.INVALID_FILENAME_MESSAGE, isFolder ? Strings.DIRECTORY_NAMES_LEDE : Strings.FILENAMES_LEDE, _invalidChars)
);
return false;
}
Expand Down Expand Up @@ -1657,15 +1658,13 @@ define(function (require, exports, module) {
};

var errorCallback = function (error, entry) {
var entryType = isFolder ? Strings.DIRECTORY : Strings.FILE,
oppositeEntryType = isFolder ? Strings.FILE : Strings.DIRECTORY;
var titleType = isFolder ? Strings.DIRECTORY_NAME : Strings.FILENAME,
entryType = isFolder ? Strings.DIRECTORY : Strings.FILE;
if (error === FileSystemError.ALREADY_EXISTS) {
var useOppositeType = (isFolder === entry.isFile);
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
StringUtils.format(Strings.INVALID_FILENAME_TITLE, entryType),
StringUtils.format(Strings.FILE_ALREADY_EXISTS,
useOppositeType ? oppositeEntryType : entryType,
StringUtils.format(Strings.INVALID_FILENAME_TITLE, titleType),
StringUtils.format(Strings.ENTRY_WITH_SAME_NAME_EXISTS,
StringUtils.breakableUrl(data.rslt.name))
);
} else {
Expand Down
5 changes: 5 additions & 0 deletions src/styles/brackets.less
Original file line number Diff line number Diff line change
Expand Up @@ -1552,3 +1552,8 @@ label input {
transform: scale(1);
}
}

.emphasized {
font-weight: 900;
font-size: 1.01em;
}

0 comments on commit f3f011a

Please sign in to comment.