minio-js icon indicating copy to clipboard operation
minio-js copied to clipboard

In the chunk merging method, special characters and Chinese characters are not handled, causing files containing special characters or Chinese characters to throw errors during the merging process.

Open Guohao0509 opened this issue 9 months ago • 4 comments

in there: composeObject ->> headers['x-amz-copy-source'] = ${sourceObj}

Guohao0509 avatar Feb 18 '25 09:02 Guohao0509

Please share the trace error/details @Guohao0509

prakashsvmx avatar Feb 18 '25 09:02 prakashsvmx

Invalid character in header content ["x-amz-copy-source"] (uncaughtException throw 1 times on pid:67602)
    at ClientRequest.setHeader (node:_http_outgoing:579:3)
    at new ClientRequest (node:_http_client:262:14)
    at Object.request (node:http:96:10)
    at _makeRequest (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:549:32)
    at Client.getBucketRegion (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:594:44)
    at Client.makeRequestStream (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:579:10)
    at Client.makeRequest (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:482:10)
    at Client.uploadPartCopy (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:3776:17)
    at /opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/async/dist/async.js:246:13
    at eachOfArrayLike (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/async/dist/async.js:506:13)
    at eachOf (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/async/dist/async.js:626:16)
    at awaitable (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/async/dist/async.js:211:32)
    at _asyncMap (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/async/dist/async.js:244:16)
    at Object.map (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/async/dist/async.js:749:16)
    at Object.awaitable [as map] (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/async/dist/async.js:211:32)
    at performUploadParts (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:3925:24)
    at /opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:3944:9
    at DestroyableTransform.<anonymous> (/opt/opsmgr/web/components/dfe.1/bin/dfe-form/node_modules/minio/dist/main/minio.js:2287:101)
    ...
code: "ERR_INVALID_CHAR"
pid: 67602
hostname: aiot-20210731-01.novalocal

Guohao0509 avatar Feb 20 '25 09:02 Guohao0509

a valid reproducer code would help or a trace for this above scenario.

prakashsvmx avatar Feb 20 '25 10:02 prakashsvmx

src/internal/client.ts

Line 1454 in 2813

headers['x-amz-copy-source'] = `${sourceObj}`

If the fileName has Chinese characters and is not escaped, an error will occur

async compose (objectIds, fileName, bucket) {
    const sourceList = objectIds.map((objId) => {
      return new MinIOHelpers.CopySourceOptions({
        Bucket: bucket,
        Object: objId
      })
    })
    const destOption = new MinIOHelpers.CopyDestinationOptions({
      Bucket: bucket,
      Object: fileName
    })
    try {
      await this.app.minioClient.composeObject(destOption, sourceList)
    } catch (error) {
      throw new Exception(ErrorCode.COMPOSE_FILES_FAILED);
    }
  }

Guohao0509 avatar Feb 24 '25 02:02 Guohao0509