RocketChat / RocketChat/Rocket.Chat
Files with `html` tags stored in a `FileSystem` Storage Type are changed after download.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
Files with html tags stored in a FileSystem Storage Type are changed after download.
Steps to reproduce:
- Go to direct messages.
- Send file
index.htmlwith content:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
- Download
index.htmlfile - Check the content of the file. It is different from that what has been sent
<!DOCTYPE html>
<html>
<body>
<noscript style=
Expected behavior:
The downloaded file should not change
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Actual behavior:
The content of the downloaded file has been changed.
<!DOCTYPE html>
<html>
<body>
<noscript style=
Server Setup Information:
- Version of Rocket.Chat Server: 5.4.2
- Operating System: Ubuntu 20.04.3 LTS
- Deployment Method: docker
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: v14.19.3
- MongoDB Version: 5.0.14 / wiredTiger (oplog enabled)
- Storage Type: FileSystem
Client Setup Information
- Desktop App or Browser Version: 3.8.13
- Operating System: Ubuntu 20.04.3 LTS
Additional context
Uploaded files are stored in the server's File system without change. They mutate after downloading
Logs
rocketchat_1 | {"level":35,"time":"2023-02-28T08:11:58.073Z","pid":1,"hostname":"8f4a643cacc0","name":"API","method":"GET","url":"/api/apps/externalComponents","userId":"GdpecmZ3Gx5JFajHX","userAgent":"
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36","host":"****************","referer":"https://****************/group/test","remoteIP":"*.*.*.*","status":200,"responseTime":1}
nginx_1 | 172.68.50.241 - - [28/Feb/2023:08:11:58 +0000] "GET /api/apps/externalComponents HTTP/1.1" 200 74 "https://****************/group/test" "Mozilla/5.0 (X11; Linux x86_64) AppleWebK
[it/537.36](http://it/537.36) (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36" "*.*.*.*"
nginx_1 | 172.68.50.241 - - [28/Feb/2023:08:11:59 +0000] "GET /file-upload/CugdubDMHypR6325Q/test_html_FileStorage.txt?download HTTP/1.1" 200 3606 "https://****************/group/test" "Mo
zilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36" "*.*.*.*"
nginx_1 | 2023/02/28 08:11:59 [warn] 15#15: *558 upstream sent more data than specified in "Content-Length" header while reading upstream, client: *.*.*.*, server: ****************, reque
st: "GET /file-upload/CugdubDMHypR6325Q/test_html_FileStorage.txt?download HTTP/1.1", upstream: "http://172.26.0.4:3000/file-upload/CugdubDMHypR6325Q/test_html_FileStorage.txt?download", host: "****************", referrer: "https://****************/group/test"
rocketchat_1 | {"level":30,"time":"2023-02-28T08:12:00.549Z","pid":1,"hostname":"8f4a643cacc","name":"SyncedCron","msg":"Starting \"Generate download files for user data\"."}
rocketchat_1 | {"level":30,"time":"2023-02-28T08:12:00.550Z","pid":1,"hostname":"8f4a643cacc","name":"SyncedCron","msg":"Finished \"Generate download files for user data\"."}
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 by reproducing the download through the /file-upload/... endpoint described in the logs, using an HTML file stored with the FileSystem storage type. Trace the server-side download path and compare the stored bytes with the response. Done means the downloaded file matches the uploaded content and the reproduction no longer changes the HTML.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100