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

guessExtension fallback to clientExtension #2128

Merged
merged 2 commits into from
Aug 13, 2019

Conversation

MGatner
Copy link
Member

@MGatner MGatner commented Aug 12, 2019

Description
Currently UploadedFile.php has getExtension() returning a string (not nullable) but Mimes::guessExtensionFromType() can return null, effectively causing an exception anytime a file is uploaded whose extension does not match the current Mime config list. This change causes getExtension() to return the client file's extension if Mime returns null.

I suspect this was the original intent for passing $this->getClientExtension() as the second parameter to Mimes::guessExtensionFromType(), but that acts as an arbitrator for duplicates rather than a fallback.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@lonnieezell lonnieezell merged commit 48ca50b into codeigniter4:develop Aug 13, 2019
@MGatner MGatner deleted the getextension-null branch August 13, 2019 10:53
@sfadschm sfadschm mentioned this pull request Dec 3, 2020
1 task
@sfadschm sfadschm mentioned this pull request Jan 3, 2021
2 tasks
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