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

Fix: Fixed double file extension in zip #13

Conversation

shourav9884
Copy link

Earlier, files inside the zip file (when we are downloading all) was being name with double extension (#9 )
Before:
Screenshot 2024-09-12 at 1 11 15 AM

Now it is fixed

Screenshot 2024-09-12 at 1 11 52 AM

@colbyfayock
Copy link
Contributor

hey thanks for the PR. it looks like the fix though ends up trimming too much from the name

image

im trying to think of why im adding the additional format in the first place if the name already has the extension... perhaps you can think of a situation where the name wouldn't include? if they were uploading a file without the extension? but i would consider that an edge case

i think a better route may be to:

  • continue with the split, but only pop off the last segment, which would be the format, then rejoin (the risk is we're assuming there's a format on there
  • a better route may be to check if the format that will be applied already exists
let downloadName = name;

if ( !downloadName.endsWith(`.${format}`) {
downloadName = `${downloadName}.${format}`
}

wdyt?

@shourav9884
Copy link
Author

yes... my commit does not work that fine.. but checking name ending with format is not also bug-proof. Sometimes when we upload file with jpeg extension (for example: test1.jpeg). we are getting jpg as extension.

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.

2 participants