diff --git a/services/web/app/coffee/Features/TokenAccess/TokenAccessHandler.coffee b/services/web/app/coffee/Features/TokenAccess/TokenAccessHandler.coffee index b1778d3f12..6a45280d42 100644 --- a/services/web/app/coffee/Features/TokenAccess/TokenAccessHandler.coffee +++ b/services/web/app/coffee/Features/TokenAccess/TokenAccessHandler.coffee @@ -101,7 +101,7 @@ module.exports = TokenAccessHandler = checkV1Access: (token, callback=(err, allow, redirect)->) -> return callback(null, true) unless Settings.apis?.v1? - V1Api.request { url: "/api/v1/sharelatex/docs/#{token}/read" }, (err, response, body) -> + V1Api.request { url: "/api/v1/sharelatex/docs/#{token}/is_published" }, (err, response, body) -> return callback err if err? callback null, false, body.published_path if body.allow == false callback null, true diff --git a/services/web/test/acceptance/coffee/helpers/MockV1Api.coffee b/services/web/test/acceptance/coffee/helpers/MockV1Api.coffee index 5ecd11a991..f9a7aed451 100644 --- a/services/web/test/acceptance/coffee/helpers/MockV1Api.coffee +++ b/services/web/test/acceptance/coffee/helpers/MockV1Api.coffee @@ -82,7 +82,7 @@ module.exports = MockV1Api = console.error "error starting MockV1Api:", error.message process.exit(1) - app.get '/api/v1/sharelatex/docs/:token/read', (req, res, next) => + app.get '/api/v1/sharelatex/docs/:token/is_published', (req, res, next) => res.json { allow: true } MockV1Api.run() diff --git a/services/web/test/unit/coffee/TokenAccess/TokenAccessHandlerTests.coffee b/services/web/test/unit/coffee/TokenAccess/TokenAccessHandlerTests.coffee index d934f31957..350dff0638 100644 --- a/services/web/test/unit/coffee/TokenAccess/TokenAccessHandlerTests.coffee +++ b/services/web/test/unit/coffee/TokenAccess/TokenAccessHandlerTests.coffee @@ -459,7 +459,7 @@ describe "TokenAccessHandler", -> @TokenAccessHandler.checkV1Access @token, @callback it 'should check api', -> - expect(@V1Api.request.calledWith { url: "/api/v1/sharelatex/docs/#{@token}/read" }).to.equal true + expect(@V1Api.request.calledWith { url: "/api/v1/sharelatex/docs/#{@token}/is_published" }).to.equal true it 'should callback with true', -> expect(@callback.calledWith null, true).to.equal true