mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 10:05:24 -05:00
Check for blank string in clsi cookie caching
ioredis returns "" for a blank entry, the previous driver returned null, so also check for a blank string
This commit is contained in:
parent
6338835baf
commit
f708a0cd81
2 changed files with 10 additions and 3 deletions
|
@ -19,10 +19,10 @@ module.exports = ClsiCookieManager =
|
||||||
rclient.get buildKey(project_id), (err, serverId)->
|
rclient.get buildKey(project_id), (err, serverId)->
|
||||||
if err?
|
if err?
|
||||||
return callback(err)
|
return callback(err)
|
||||||
if serverId?
|
if !serverId? or serverId == ""
|
||||||
return callback(null, serverId)
|
|
||||||
else
|
|
||||||
return ClsiCookieManager._populateServerIdViaRequest project_id, callback
|
return ClsiCookieManager._populateServerIdViaRequest project_id, callback
|
||||||
|
else
|
||||||
|
return callback(null, serverId)
|
||||||
|
|
||||||
|
|
||||||
_populateServerIdViaRequest :(project_id, callback = (err, serverId)->)->
|
_populateServerIdViaRequest :(project_id, callback = (err, serverId)->)->
|
||||||
|
|
|
@ -60,6 +60,13 @@ describe "ClsiCookieManager", ->
|
||||||
@ClsiCookieManager._populateServerIdViaRequest.calledWith(@project_id).should.equal true
|
@ClsiCookieManager._populateServerIdViaRequest.calledWith(@project_id).should.equal true
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
it "should _populateServerIdViaRequest if no key is blank", (done)->
|
||||||
|
@ClsiCookieManager._populateServerIdViaRequest = sinon.stub().callsArgWith(1)
|
||||||
|
@redis.get.callsArgWith(1, null, "")
|
||||||
|
@ClsiCookieManager._getServerId @project_id, (err, serverId)=>
|
||||||
|
@ClsiCookieManager._populateServerIdViaRequest.calledWith(@project_id).should.equal true
|
||||||
|
done()
|
||||||
|
|
||||||
|
|
||||||
describe "_populateServerIdViaRequest", ->
|
describe "_populateServerIdViaRequest", ->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue