Conversation
landreev
left a comment
There was a problem hiding this comment.
I really thought we had fixed this a while ago; but it appears we only talked about fixing it, but never got around to it. Great to see it fixed it finally.
Looks good. (To be clear, this was broken for all stores, not just the remote kind; it wasn't working with the filesystem storage either - because it was running the check on the internal, storageidentifier-based filename).
|
A couple questions:
|
|
No, this PR does not close #8821. I'll check if that weird part of #7527 was still happening in our prod. If it is, it would be great to actually figure out what's going on there (should not block or delay merging this PR though). |
|
|
||
| logger.fine("target file: " + localFile); | ||
| String newlyDetectedContentType = FileTypeDetection.determineFileType(localFile); | ||
| String newlyDetectedContentType = FileUtil.determineFileType(localFile, fileToRedetect.getDisplayName()); |
There was a problem hiding this comment.
Can we add a null check in the next line here? - From looking at #8821, it appears that determineFileType() may return null here, for especially unrecognizable files; and that results in a constraint violation.
Sorry for asking for this while the PR is already in QA; but would be a trivial change. Thanks.
There was a problem hiding this comment.
The change in FileUtil.java in this PR prevents a null return, so I think we're good?
There was a problem hiding this comment.
Oh, of course, doh! Thanks!
|
Yes, this PR closes #8821 as well. Sorry for the extra noise. |
What this PR does / why we need it: For non File Stores, redetect was using the name of the temp file and it's extension (always .tmp) to determine the mimetype, and with .tmp not mapping to a known mimetype could return null as the answer (if other detect steps didn't work). This fix provides the name from the datafile in the db and sends 'application/octet-stream' if no other determination was made.
Which issue(s) this PR closes:
Closes #7527
Closes #8821
Special notes for your reviewer: Ran across this when doing other refactoring - would be good if someone who was following the issue could verify that this fixes both aspects.
Suggestions on how to test this: per the issue.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?:
Additional documentation: