Skip to content
Discussion options

You must be logged in to vote

For security reasons, whenever the file is saved locally, it uses the provided content type to determine the extension. It is a lot better to trust browsers than end users when providing files. Trusting the uploaded file name and its extension is a problem, as they are easy to manipulate and may not be valid for the target operating/filesystem.

Therefore the FormDataFile provides both the .filename and .originalName as part of the structure (as well as the provided .contentType), so if you "trust" what is uploaded, you can do post processing to reconcile it, using whatever logic you are comfortable with from a security and usability perspective.

Adding an option to automatically do this d…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mdkq
Comment options

Answer selected by mdkq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #471 on February 10, 2022 22:52.