Skip to content

Commit

Permalink
fixes issue where project name could have a / in it, which is not a v…
Browse files Browse the repository at this point in the history
…alid directory
  • Loading branch information
jackcmeyer authored and Erica Clark committed Jan 21, 2018
1 parent d326495 commit e1e7e9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/utils/project-configuration-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ export function validateProjectName(value) {
// a project name is a project name for which the folder does not exist,
// for which the name is no blank/undefined or contains spaces

// TODO: this validation allows for project names with /, which would not create a valid directory
if (typeof value === 'undefined' || value === ''
|| value.indexOf(' ') !== -1 || !isValidPath(value)) {
|| value.indexOf(' ') !== -1 || !isValidPath(value) || value.indexOf('/') > -1) {
return 'Invalid project name!';
}

Expand Down
3 changes: 1 addition & 2 deletions test/project-configuration-validator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ describe('Project Configuration Validator', () => {
assert.equal(validateProjectName('**baddname'), 'Invalid project name!');
assert.equal(validateProjectName(), 'Invalid project name!');
assert.equal(validateProjectName('thisisaverylongnamethatisovertwentycharacterslong'), 'Project Names must be less than 20 characters or less!');
//TODO add validation for / when it gets fixed
//assert.equal(validateProjectName("jack/"), 'Invalid project name!')
assert.equal(validateProjectName("test1/"), 'Invalid project name!')
});

});
Expand Down

0 comments on commit e1e7e9a

Please sign in to comment.