Skip to content

Commit

Permalink
Merge pull request #762 from mesosphere/fix/no-multi-slashes
Browse files Browse the repository at this point in the history
Disallow multiple forward slashes
  • Loading branch information
Poltergeist committed Apr 25, 2016
2 parents 7c7a47c + a48e944 commit 16fc063
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
applications
- \#3793 Wrong application status

### Changed
- \#3660 - Multiple forward slashes allowed in app ID

## 1.1.2 - 2016-04-14
### Fixed
- \#3763 - Enable multiple general errors from server response
Expand Down
1 change: 1 addition & 0 deletions src/js/constants/AppFormErrorMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const applicationFieldValidationErrors = Util.deepFreeze({
appId: [
"ID must not be empty",
"Path must not contain whitespace",
"Path must not contain multiple forward slashes",
"Path contains invalid characters " +
"(allowed: lowercase letters, digits, hyphens, \".\", \"..\")",
"Path is not well-formed"
Expand Down
1 change: 1 addition & 0 deletions src/js/stores/AppFormStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const validationRules = {
"appId": [
AppFormValidators.appIdNotEmpty,
AppFormValidators.appIdNoWhitespaces,
AppFormValidators.appIdNoMultipleSlashes,
AppFormValidators.appIdValidChars,
AppFormValidators.appIdWellFormedPath
],
Expand Down
2 changes: 2 additions & 0 deletions src/js/stores/validators/AppFormValidators.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const AppFormValidators = {

appIdNoWhitespaces: (str) => str.match(/ /g) == null,

appIdNoMultipleSlashes: (str) => str.match(/\/{2,}/g) == null,

appIdValidChars: (str) => str.match(/[^a-z0-9\-\.\/]/g) == null,

appIdWellFormedPath: (str) => {
Expand Down
10 changes: 10 additions & 0 deletions src/test/units/AppFormValidators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ describe("App Form Validators", function () {
.to.be.false;
});

it("has no multiple forward slashes", function () {
expect(this.validatior.appIdNoMultipleSlashes("/hello/world"))
.to.be.true;
});

it("has multiple forward slashes", function () {
expect(this.validatior.appIdNoMultipleSlashes("/hello//world////"))
.to.be.false;
});

it("has no illegal characters", function () {
expect(this.validatior.appIdValidChars("./app-1.b")).to.be.true;
});
Expand Down

0 comments on commit 16fc063

Please sign in to comment.