Trim the project name again after fixing (#15682)

GitOrigin-RevId: 74c87ee1689668a058a162a1f456815e0748b049
This commit is contained in:
Alf Eaton 2023-11-09 11:22:34 +00:00 committed by Copybot
parent 84500f0cb4
commit b0effa7e4a
2 changed files with 8 additions and 0 deletions

View file

@ -193,6 +193,8 @@ function fixProjectName(name) {
if (name.length > MAX_PROJECT_NAME_LENGTH) {
name = name.substr(0, MAX_PROJECT_NAME_LENGTH)
}
// Remove any leading or trailing whitespace after fixing
name = name.trim()
return name
}

View file

@ -439,6 +439,12 @@ describe('ProjectDetailsHandler', function () {
it('should accept normal names', function () {
expect(this.handler.fixProjectName('foobar')).to.equal('foobar')
})
it('should trim name after truncation', function () {
expect(this.handler.fixProjectName('a'.repeat(149) + ' a')).to.equal(
'a'.repeat(149)
)
})
})
describe('setPublicAccessLevel', function () {