Fix flags protecting getV1DocPublishedInfo access (#2395)

GitOrigin-RevId: 9122d06cae52ff0b949a2904e485aa70ca3de896
This commit is contained in:
Miguel Serrano 2019-11-25 11:39:14 +01:00 committed by sharelatex
parent 9bfe58a959
commit 0866b9de9b
2 changed files with 3 additions and 2 deletions

View file

@ -255,7 +255,7 @@ const TokenAccessHandler = {
getV1DocPublishedInfo(token, callback) {
// default to allowing access
if (!Settings.apis || !Settings.apis.v1) {
if (!Settings.apis.v1 || !Settings.apis.v1.url) {
return callback(null, { allow: true })
}
V1Api.request(

View file

@ -925,6 +925,7 @@ describe('TokenAccessHandler', function() {
describe('when v1 api not set', function() {
beforeEach(function() {
this.settings.apis = { v1: undefined }
return this.TokenAccessHandler.getV1DocPublishedInfo(
this.token,
this.callback
@ -943,7 +944,7 @@ describe('TokenAccessHandler', function() {
describe('when v1 api is set', function() {
beforeEach(function() {
return (this.settings.apis = { v1: 'v1' })
return (this.settings.apis = { v1: { url: 'v1Url' } })
})
describe('on V1Api.request success', function() {