This repository was archived by the owner on Jun 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -259,8 +259,11 @@ export class Oauth2Auth extends AlfrescoApiClient {
259259 isPublicUrl ( ) : boolean {
260260 const publicUrls = this . config . oauth2 . publicUrls || [ ] ;
261261
262- return publicUrls . length &&
263- publicUrls . some ( ( urlPattern : string ) => minimatch ( window . location . href , urlPattern ) ) ;
262+ if ( Array . isArray ( publicUrls ) ) {
263+ return publicUrls . length &&
264+ publicUrls . some ( ( urlPattern : string ) => minimatch ( window . location . href , urlPattern ) ) ;
265+ }
266+ return false ;
264267 }
265268
266269 padBase64 ( base64data : any ) {
Original file line number Diff line number Diff line change @@ -229,6 +229,13 @@ describe('Oauth2 test', function () {
229229 expect ( this . oauth2Auth . isPublicUrl ( ) ) . to . be . equal ( false ) ;
230230 } ) ;
231231
232+ it ( 'should return `false` if public urls is not set as an array list' , function ( ) {
233+ globalAny . window = { location : { href : 'public-url-string' } } ;
234+ this . oauth2Auth . config . oauth2 . publicUrls = 'public-url-string' ;
235+
236+ expect ( this . oauth2Auth . isPublicUrl ( ) ) . to . be . equal ( false ) ;
237+ } ) ;
238+
232239 it ( 'should match absolute path' , function ( ) {
233240 globalAny . window = { location : { href : 'http://some-public-url' } } ;
234241 this . oauth2Auth . config . oauth2 . publicUrls = [ 'http://some-public-url' ] ;
You can’t perform that action at this time.
0 commit comments