File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ async function requestHandler(
54
54
if ( ! request . isAuthenticated ) {
55
55
// The bucket must be public to access its content
56
56
if ( ! bucket ?. public ) {
57
- throw ERRORS . AccessDenied ( 'Access denied to this bucket' )
57
+ throw ERRORS . NoSuchBucket ( bucketName )
58
58
}
59
59
}
60
60
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ async function requestHandler(
46
46
// Not Authenticated flow
47
47
if ( ! request . isAuthenticated ) {
48
48
if ( ! bucket ?. public ) {
49
- throw ERRORS . AccessDenied ( 'Access denied to this bucket' )
49
+ throw ERRORS . NoSuchBucket ( bucketName )
50
50
}
51
51
}
52
52
Original file line number Diff line number Diff line change @@ -99,7 +99,11 @@ export function generateUrl(
99
99
const port = req . headers [ 'x-forwarded-port' ]
100
100
101
101
if ( typeof port === 'string' && port && ! [ '443' , '80' ] . includes ( port ) ) {
102
- host += `:${ req . headers [ 'x-forwarded-port' ] } `
102
+ if ( ! host . includes ( ':' ) ) {
103
+ host += `:${ req . headers [ 'x-forwarded-port' ] } `
104
+ } else {
105
+ host = host . replace ( / : \d + $ / , `:${ req . headers [ 'x-forwarded-port' ] } ` )
106
+ }
103
107
}
104
108
}
105
109
Original file line number Diff line number Diff line change @@ -329,7 +329,11 @@ export class SignatureV4 {
329
329
const host = `host:${ xForwardedHost . toLowerCase ( ) } `
330
330
331
331
if ( port && ! [ '443' , '80' ] . includes ( port ) ) {
332
- return host + ':' + port
332
+ if ( ! host . includes ( ':' ) ) {
333
+ return host + ':' + port
334
+ } else {
335
+ return host . replace ( / : \d + $ / , `:${ port } ` )
336
+ }
333
337
}
334
338
return host
335
339
}
You can’t perform that action at this time.
0 commit comments