mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #15473 from overleaf/jel-remove-encoded-hash
[web] Remove encoded hashtag when checking token hash prefix GitOrigin-RevId: 2b9c369beceb7897d0f6f165b4c3a70b79c14469
This commit is contained in:
parent
3cd0cefd30
commit
a3251394e1
2 changed files with 19 additions and 1 deletions
|
@ -291,7 +291,7 @@ const TokenAccessHandler = {
|
|||
let hashPrefixStatus
|
||||
|
||||
if (tokenHashPrefix) {
|
||||
tokenHashPrefix = tokenHashPrefix.replace('#', '')
|
||||
tokenHashPrefix = tokenHashPrefix.replace('#', '').replace('%23', '')
|
||||
}
|
||||
|
||||
if (!tokenHashPrefix) {
|
||||
|
|
|
@ -719,5 +719,23 @@ describe('TokenAccessHandler', function () {
|
|||
}
|
||||
)
|
||||
})
|
||||
it('it handles encoded hashtags', function () {
|
||||
const token = 'zxpxjrwdtsgd'
|
||||
const prefix = this.TokenAccessHandler.createTokenHashPrefix(token)
|
||||
|
||||
this.TokenAccessHandler.checkTokenHashPrefix(
|
||||
token,
|
||||
`%23${prefix}`,
|
||||
'readOnly'
|
||||
)
|
||||
|
||||
expect(this.Metrics.inc).to.have.been.calledWith(
|
||||
'link-sharing.hash-check',
|
||||
{
|
||||
path: 'readOnly',
|
||||
status: 'match',
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue