Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the option to only keep the last part of the original filename as the extension if the keepExtensions option is set to true #888

Closed
wants to merge 1 commit into from

Conversation

Wengiel31
Copy link

@Wengiel31 Wengiel31 commented Oct 1, 2022

Added option "longExtentions" (defaults to false). If this is set and "keepExtensions" is set to true extension of the new filename will be random.c instead of random.b.c assuming that the original filename was a.b.c.
This fixes issue 887.

Also removed an additional space on line 524 of Formidable.js

…as the extension if the keepExtensions option is set to true
@GrosSacASac
Copy link
Contributor

I am not sure. This kind of PR has the potential to go infinite.
If everyone starts adding a boolean option to half change something in the output this lib can grow in a monstrosity

@GrosSacASac
Copy link
Contributor

Consider using the options.filename . this will let you do what you want with the name and extension

@Wengiel31
Copy link
Author

Wengiel31 commented Oct 5, 2022

Consider using the options.filename . this will let you do what you want with the name and extension

In order to do that I would need access to original filename to which I only get the access it in the callback of form.prase, but I need that original filename to create that form with the .parse method

@GrosSacASac
Copy link
Contributor

No. You also access to originalFilename in the filename function

                filename: (name, ext, part/*, form*/) => {
                    const {originalFilename} = part;

@Wengiel31 Wengiel31 closed this Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keeping the original filename extension keeps more than is should
2 participants