Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
Adding specific file extension to Parse Server config under fileUpload.fileExtensions option doesn't work. When I upload quicktime file I get error with the code 130 and message "File upload of extension quicktime is disabled.".
I checked the code and I think there is a bug here: https://github.com/parse-community/parse-server/blob/c9b59719ec9648f9ba8bbef89db2a24a227ae55c/src/Routers/FilesRouter.js#L150C24-L150C24
Instead of
const regex = new RegExp(fileExtensions);
there should be
const regex = new RegExp(ext);
as fileExtensions is an array of patterns and every pattern should be tested separately.
Steps to reproduce
Set file upload config (standard extensions + quicktime extension):
{ fileUpload: { fileExtensions: ["^[^hH][^tT][^mM][^lL]?$", "^quicktime$"], }}
Actual Outcome
Parse Server doesn't allow me to upload quicktime file.
Expected Outcome
I should be able to add any extension.
Environment
Server
- Parse Server version: 6.2.1
- Operating system: MacOS Ventura 13.0.1
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local
Database
- System (MongoDB or Postgres): MongoDB
- Database version: 4.0.28
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): remote VPS
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript (React-Native)
- SDK version: 4.0.1