mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #17865 from overleaf/jpa-open-in-overleaf-session-storage
[web] open-in-overleaf: cleanup redis and browser session storage GitOrigin-RevId: af79bb49ff474545fc0d206d2a6f5a0ffa1416bc
This commit is contained in:
parent
e100d85940
commit
ac2ea9f34d
2 changed files with 17 additions and 1 deletions
|
@ -77,7 +77,10 @@ class SessionAutostartMiddleware {
|
|||
}
|
||||
|
||||
middleware(req, _res, next) {
|
||||
if (!req.signedCookies[this._cookieName]) {
|
||||
if (
|
||||
!req.signedCookies[this._cookieName] &&
|
||||
req.query?.autostartSession !== 'true'
|
||||
) {
|
||||
const callback = this.autostartCallbackForRequest(req)
|
||||
if (callback) {
|
||||
req.session = {
|
||||
|
|
|
@ -48,12 +48,25 @@ describe('SessionAutostartMiddleware', function () {
|
|||
expect(req.session.noSessionCallback).to.equal(excludedCallback)
|
||||
})
|
||||
|
||||
it('does not execute the callback for the excluded route with ?autostartSession=true set', function () {
|
||||
req.query = { autostartSession: 'true' }
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('does not execute the callback if the method is not excluded', function () {
|
||||
req.method = 'GET'
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('does not execute the callback if the method is not excluded and ?autostartSession=true is set', function () {
|
||||
req.method = 'GET'
|
||||
req.query = { autostartSession: 'true' }
|
||||
middleware.middleware(req, {}, next)
|
||||
expect(req.session).not.to.exist
|
||||
})
|
||||
|
||||
it('does not execute the callback if the path is not excluded', function () {
|
||||
req.path = '/giraffe'
|
||||
middleware.middleware(req, {}, next)
|
||||
|
|
Loading…
Reference in a new issue