fix(xo-remote-parser): correctly handle empty S3 region
Introduced by c219ea0
This commit is contained in:
parent
c964a1471a
commit
ab9428a9c4
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
<!--packages-start-->
|
<!--packages-start-->
|
||||||
|
|
||||||
|
- xo-remote-parser patch
|
||||||
- xo-server-transport-nagios patch
|
- xo-server-transport-nagios patch
|
||||||
|
|
||||||
<!--packages-end-->
|
<!--packages-end-->
|
||||||
|
@ -71,7 +71,7 @@ export const parse = string => {
|
|||||||
const parsed = urlParser(string, false)
|
const parsed = urlParser(string, false)
|
||||||
object.protocol = parsed.protocol === 's3:' ? 'https' : 'http'
|
object.protocol = parsed.protocol === 's3:' ? 'https' : 'http'
|
||||||
object.type = 's3'
|
object.type = 's3'
|
||||||
object.region = parsed.hash.length === 0 ? undefined : parsed.hash.slice(1) // remove '#'
|
object.region = parsed.hash.length < 2 ? undefined : parsed.hash.slice(1) // remove '#'
|
||||||
object.host = parsed.host
|
object.host = parsed.host
|
||||||
object.path = parsed.pathname
|
object.path = parsed.pathname
|
||||||
object.username = parsed.username
|
object.username = parsed.username
|
||||||
|
@ -171,6 +171,18 @@ const parseData = deepFreeze({
|
|||||||
allowUnauthorized: true,
|
allowUnauthorized: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
's3 with empty region ': {
|
||||||
|
string: 's3://AKIAS:XSuBupZ0mJlu%2B@s3-us-west-2.amazonaws.com/test-bucket/dir#',
|
||||||
|
object: {
|
||||||
|
type: 's3',
|
||||||
|
protocol: 'https',
|
||||||
|
host: 's3-us-west-2.amazonaws.com',
|
||||||
|
path: '/test-bucket/dir',
|
||||||
|
username: 'AKIAS',
|
||||||
|
password: 'XSuBupZ0mJlu+',
|
||||||
|
region: undefined,
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const formatData = deepFreeze({
|
const formatData = deepFreeze({
|
||||||
|
Loading…
Reference in New Issue
Block a user