mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge branch 'sk-dont-redirect-to-images'
This commit is contained in:
commit
4e3284cec8
2 changed files with 13 additions and 1 deletions
|
@ -196,7 +196,11 @@ module.exports = AuthenticationController =
|
|||
_setRedirectInSession: (req, value) ->
|
||||
if !value?
|
||||
value = if Object.keys(req.query).length > 0 then "#{req.path}?#{querystring.stringify(req.query)}" else "#{req.path}"
|
||||
if req.session? && !value.match(new RegExp('^\/(socket.io|js|stylesheets|img)\/.*$'))
|
||||
if (
|
||||
req.session? &&
|
||||
!value.match(new RegExp('^\/(socket.io|js|stylesheets|img)\/.*$')) &&
|
||||
!value.match(new RegExp('^.*\.(png|jpeg|svg)$'))
|
||||
)
|
||||
req.session.postLoginRedirect = value
|
||||
|
||||
_getRedirectFromSession: (req) ->
|
||||
|
|
|
@ -555,6 +555,14 @@ describe "AuthenticationController", ->
|
|||
@AuthenticationController._setRedirectInSession(@req, '/somewhere/specific')
|
||||
expect(@req.session.postLoginRedirect).to.equal "/somewhere/specific"
|
||||
|
||||
describe 'with a png', ->
|
||||
beforeEach ->
|
||||
@req = {session: {}}
|
||||
|
||||
it 'should not set the redirect', ->
|
||||
@AuthenticationController._setRedirectInSession(@req, '/something.png')
|
||||
expect(@req.session.postLoginRedirect).to.equal undefined
|
||||
|
||||
describe 'with a js path', ->
|
||||
|
||||
beforeEach ->
|
||||
|
|
Loading…
Reference in a new issue