Skip to content

Commit

Permalink
Fix #1372 - File download with encoded etag (#1373)
Browse files Browse the repository at this point in the history
* Replaced etag with base64 encoded version to prevent slash character issue.
  • Loading branch information
duckboy81 authored Jan 20, 2025
1 parent fd12add commit a8e1abb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/internal/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ export class TypedClient {

/**
* download object content to a file.
* This method will create a temp file named `${filename}.${etag}.part.minio` when downloading.
* This method will create a temp file named `${filename}.${base64(etag)}.part.minio` when downloading.
*
* @param bucketName - name of the bucket
* @param objectName - name of the object
Expand All @@ -1112,7 +1112,8 @@ export class TypedClient {
const downloadToTmpFile = async (): Promise<string> => {
let partFileStream: stream.Writable
const objStat = await this.statObject(bucketName, objectName, getOpts)
const partFile = `${filePath}.${objStat.etag}.part.minio`
const encodedEtag = Buffer.from(objStat.etag).toString('base64')
const partFile = `${filePath}.${encodedEtag}.part.minio`

await fsp.mkdir(path.dirname(filePath), { recursive: true })

Expand Down

0 comments on commit a8e1abb

Please sign in to comment.