mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 05:33:01 +00:00
Trim the project name again after fixing (#15682)
GitOrigin-RevId: 74c87ee1689668a058a162a1f456815e0748b049
This commit is contained in:
parent
84500f0cb4
commit
b0effa7e4a
2 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in a new issue