RocketChat / RocketChat/Rocket.Chat
Files with an ampersand '&' in their name are corrupted when downloading from Minio
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
When using Minio as AmazonS3 storage, files containing an ampersand character in the name are downloaded with an error in their content.
The downloaded file contains xml with the following error description:
SignatureDoesNotMatch The request signature we calculated does not match the signature you provided. Check your key and signing method
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method</Message>
<Key>*****</Key><BucketName>****</BucketName><Resource>****</Resource>
<RequestId>****</RequestId>
<HostId>****</HostId>
</Error>
Steps to reproduce:
- Connect MINIO to Rocket.chat as described in the article
- Upload any file containing an ampersand in the name to a private chat or room, for example "&.txt"
- Download the file and open it in a text viewer
Expected behavior:
Original file content
Actual behavior:
XML content with description of the error "SignatureDoesNotMatch..."
Server Setup Information:
- Version of Rocket.Chat Server: 5.4.8,6.1.4
- Operating System: Oracle Linux Server release 8.6
- Deployment Method: docker
- Number of Running Instances: 20
- NodeJS Version: v14.19.3
- Minio deployed as "Single-Node Single-Drive"
Client Setup Information
- Desktop App or Browser Version: Google Chrome 112.0.5615.121
- Operating System: Windows 10
Additional context
The solution with switching to SignatureV4 in a similar #27687 solves the issue of file download,
but with this we have an error when uploading:
Relevant logs:
{"type":"Error","message":"Non-file stream objects are not supported with SigV4","stack":"Error: Non-file stream objects are not supported with SigV4
at Object.computeSha256 (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/util.js:753:23)
at Request.COMPUTE_SHA256 (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/event_listeners.js:171:18)
at Request.callListeners (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/sequential_executor.js:102:18)
at Request.emit (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /app/bundle/programs/server/npm/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:688:12)
at Request.callListeners (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at Request.emit (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /app/bundle/programs/server/npm/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/request.js:688:12)
at Request.callListeners (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at callNextListener (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at /app/bundle/programs/server/npm/node_modules/aws-sdk/lib/event_listeners.js:86:9
at finish (/app/bundle/programs/server/npm/node_modules/aws-sdk/lib/config.js:396:7)","code":"Error","time":"2023-05-02T05:44:06.398Z"},"msg":"Non-file stream objects are not supported with SigV4"}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Minio/Amazon S3 storage integration and the AWS SDK request-signing path. Use the three-step reproduction with a file named "&.txt", then verify that downloading returns the original content while uploads still work; compare this with the noted SignatureV4 behavior and its upload error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100