Improve _getUpload, remove getUploadedFileType method#30
Conversation
- Separate upload handling from try/catch: file-not-uploaded logic - Build $img as a local array and assign to $this->_img at the end, rather than mutating $this->_img piecemeal throughout the method - Remove getUploadedFileType static method, inline/improve its logic - Related code improvements
TDannhauer
left a comment
There was a problem hiding this comment.
Looks like a solid cleanup: clearer success vs. non-upload paths, single assignment into $this->_img['img'], and MIME handling after the file is moved to temp storage.
BC: getUploadedFileType was removed as a public static method. Is that intentional for FRAMEWORK_6_0? If anything outside this package still calls it, we should either keep a deprecated stub or document the break in the changelog / upgrade notes.
Tests: Could you add or extend tests for this flow (happy path upload, no new file with existing hash, explicit remove)? Even a small unit/integration test would help lock in behavior after this refactor.
|
@ralflang what do you think about the BC break. is it okay? |
|
Note, the In general, other places should rely on |
$imgas a local array and assign to$this->_imgat the end, rather than mutating$this->_imgpiecemeal throughout the methodgetUploadedFileTypestatic method, inline/improve its logic