Skip to content

Commit

Permalink
fix: append port to the base url if defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Melchyore committed Oct 16, 2024
1 parent 5612c7e commit 96adc54
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/s3/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,13 @@ export class S3Driver implements DriverContract {
*/
if (this.#client.config.endpoint) {
const endpoint = await this.#client.config.endpoint()
let baseUrl = `${endpoint.protocol}//${endpoint.hostname}`

return new URL(
`/${this.options.bucket}/${key}`,
`${endpoint.protocol}//${endpoint.hostname}`
).toString()
if (endpoint.port) {
baseUrl += `:${endpoint.port}`
}

return new URL(`/${this.options.bucket}/${key}`, baseUrl).toString()
}

/**
Expand Down

0 comments on commit 96adc54

Please sign in to comment.