Skip to content

Commit

Permalink
provider-views: make trailing slash optional when validating auth ori…
Browse files Browse the repository at this point in the history
…gin (#1589)

fixes #1347
  • Loading branch information
ifedapoolarewaju authored and arturi committed Jun 4, 2019
1 parent 450ab8c commit 58fcc46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@uppy/provider-views/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ module.exports = class ProviderView {

const patterns = Array.isArray(allowedOrigin) ? allowedOrigin.map(getRegex) : [getRegex(allowedOrigin)]
return patterns
.filter((pattern) => pattern !== null)
.some((pattern) => pattern.test(origin))
.filter((pattern) => pattern != null) // loose comparison to catch undefined
.some((pattern) => pattern.test(origin) || pattern.test(`${origin}/`)) // allowing for trailing '/'
}

handleError (error) {
Expand Down

0 comments on commit 58fcc46

Please sign in to comment.