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

CommonsMultipartFile.getOriginalFilename() should be able to preserve header-specified filename as-is [SPR-14613] #19180

Closed
spring-projects-issues opened this issue Aug 22, 2016 · 1 comment
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Aug 22, 2016

Juergen Hoeller opened SPR-14613 and commented

getOriginalFilename() explicitly strips path information from a Commons-FileUpload-given filename in CommonsMultipartFile but just exposes the header-specified filename as-is in StandardMultipartFile.

Let's revisit what's actually necessary in 2016 and whether the behavior needs to be more consistent here.


Issue Links:

  • #18237 CommonsMultipartFile.getOriginalFilename() does not strip file path properly
  • #13932 StandardServletMultipartResolver should support MaxUploadSizeExceededException against common servers
  • #19822 StandardMultipartFile.transferTo should fall back to manual copy if Part.write doesn't support absolute locations (e.g. on Jetty)

Referenced from: commits 5115c61, aa29495

1 votes, 2 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 9, 2016

Juergen Hoeller commented

I've added a corresponding preserveFilename flag to CommonsMultipartResolver (or more specifically a setPreserveFilename(boolean) method to its superclass CommonsFileUploadSupport, passed on to CommonsMultipartFile: Switching that flag to true forces getOriginalFilename() to return the FileItem.getName() result as-is, not artificially stripping off any path information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.