mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 12:24:25 +02:00
coerce projectHistoryId to integer after reading from Redis
This commit is contained in:
@@ -148,6 +148,9 @@ module.exports = RedisManager =
|
||||
logger.error project_id: project_id, doc_id: doc_id, doc_project_id: doc_project_id, "doc not in project"
|
||||
return callback(new Errors.NotFoundError("document not found"))
|
||||
|
||||
if projectHistoryId?
|
||||
projectHistoryId = parseInt(projectHistoryId)
|
||||
|
||||
# doc is not in redis, bail out
|
||||
if !docLines?
|
||||
return callback null, docLines, version, ranges, pathname, projectHistoryId, unflushedTime
|
||||
|
||||
@@ -60,7 +60,7 @@ describe "RedisManager", ->
|
||||
|
||||
@doc_id = "doc-id-123"
|
||||
@project_id = "project-id-123"
|
||||
@projectHistoryId = "history-id-123"
|
||||
@projectHistoryId = 123
|
||||
@callback = sinon.stub()
|
||||
|
||||
describe "getDoc", ->
|
||||
@@ -74,7 +74,7 @@ describe "RedisManager", ->
|
||||
@unflushed_time = 12345
|
||||
@pathname = '/a/b/c.tex'
|
||||
@multi.get = sinon.stub()
|
||||
@multi.exec = sinon.stub().callsArgWith(0, null, [@jsonlines, @version, @hash, @project_id, @json_ranges, @pathname, @projectHistoryId, @unflushed_time])
|
||||
@multi.exec = sinon.stub().callsArgWith(0, null, [@jsonlines, @version, @hash, @project_id, @json_ranges, @pathname, @projectHistoryId.toString(), @unflushed_time])
|
||||
@rclient.sadd = sinon.stub().yields(null, 0)
|
||||
|
||||
describe "successfully", ->
|
||||
@@ -111,7 +111,7 @@ describe "RedisManager", ->
|
||||
.calledWith("Pathname:#{@doc_id}")
|
||||
.should.equal true
|
||||
|
||||
it "should get the projectHistoryId", ->
|
||||
it "should get the projectHistoryId as an integer", ->
|
||||
@multi.get
|
||||
.calledWith("ProjectHistoryId:#{@doc_id}")
|
||||
.should.equal true
|
||||
|
||||
Reference in New Issue
Block a user