Explorar o código

Fix flags protecting getV1DocPublishedInfo access (#2395)

GitOrigin-RevId: 9122d06cae52ff0b949a2904e485aa70ca3de896
Miguel Serrano %!s(int64=6) %!d(string=hai) anos
pai
achega
0866b9de9b

+ 1 - 1
services/web/app/src/Features/TokenAccess/TokenAccessHandler.js

@@ -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(

+ 2 - 1
services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js

@@ -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() {