mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-16 08:08:17 +00:00
add query string to end of project resources
This commit is contained in:
parent
b8510301b6
commit
b0baea5073
3 changed files with 19 additions and 9 deletions
|
@ -20,11 +20,13 @@ module.exports = ClsiManager =
|
|||
logger.err err:error, project_id:project_id, "error sending request to clsi"
|
||||
return callback(error)
|
||||
logger.log project_id: project_id, response: response, "received compile response from CLSI"
|
||||
callback(
|
||||
null
|
||||
response?.compile?.status
|
||||
ClsiManager._parseOutputFiles(project_id, response?.compile?.outputFiles)
|
||||
)
|
||||
ClsiCookieManager._getServerId project_id, (err, clsiServerId)->
|
||||
if err?
|
||||
logger.err err:err, project_id:project_id, "error getting server id"
|
||||
return callback(err)
|
||||
outputFiles = ClsiManager._parseOutputFiles(project_id, response?.compile?.outputFiles, clsiServerId)
|
||||
console.log outputFiles
|
||||
callback(null, response?.compile?.status, outputFiles)
|
||||
|
||||
deleteAuxFiles: (project_id, options, callback = (error) ->) ->
|
||||
compilerUrl = @_getCompilerUrl(options?.compileGroup)
|
||||
|
@ -74,11 +76,17 @@ module.exports = ClsiManager =
|
|||
logger.error err: error, project_id: project_id, "CLSI returned failure code"
|
||||
callback error, body
|
||||
|
||||
_parseOutputFiles: (project_id, rawOutputFiles = []) ->
|
||||
_parseOutputFiles: (project_id, rawOutputFiles = [], clsiServer) ->
|
||||
# console.log rawOutputFiles
|
||||
outputFiles = []
|
||||
for file in rawOutputFiles
|
||||
console.log path
|
||||
path = url.parse(file.url).path
|
||||
path = path.replace("/project/#{project_id}/output/", "")
|
||||
if clsiServer?
|
||||
path = "#{path}?clsiserver=#{clsiServer}"
|
||||
outputFiles.push
|
||||
path: url.parse(file.url).path.replace("/project/#{project_id}/output/", "")
|
||||
path: path
|
||||
type: file.type
|
||||
build: file.build
|
||||
return outputFiles
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
Settings = require('settings-sharelatex')
|
||||
|
||||
redis = require("redis-sharelatex")
|
||||
rclient = redis.createClient(Settings.redis.web)
|
||||
|
||||
DocumentUpdaterHandler = require "../DocumentUpdater/DocumentUpdaterHandler"
|
||||
Project = require("../../models/Project").Project
|
||||
ProjectRootDocManager = require "../Project/ProjectRootDocManager"
|
||||
|
@ -13,6 +11,8 @@ logger = require("logger-sharelatex")
|
|||
rateLimiter = require("../../infrastructure/RateLimiter")
|
||||
|
||||
module.exports = CompileManager =
|
||||
|
||||
|
||||
compile: (project_id, user_id, options = {}, _callback = (error) ->) ->
|
||||
timer = new Metrics.Timer("editor.compile")
|
||||
callback = (args...) ->
|
||||
|
|
|
@ -11,6 +11,7 @@ describe "ClsiManager", ->
|
|||
@ClsiCookieManager =
|
||||
getCookieJar: sinon.stub().callsArgWith(1, null, @jar)
|
||||
setServerId: sinon.stub().callsArgWith(2)
|
||||
_getServerId:sinon.stub()
|
||||
@ClsiManager = SandboxedModule.require modulePath, requires:
|
||||
"settings-sharelatex": @settings =
|
||||
apis:
|
||||
|
@ -32,6 +33,7 @@ describe "ClsiManager", ->
|
|||
describe "sendRequest", ->
|
||||
beforeEach ->
|
||||
@ClsiManager._buildRequest = sinon.stub().callsArgWith(2, null, @request = "mock-request")
|
||||
@ClsiCookieManager._getServerId.callsArgWith(1, null, "clsi3")
|
||||
|
||||
describe "with a successful compile", ->
|
||||
beforeEach ->
|
||||
|
|
Loading…
Add table
Reference in a new issue