-
Notifications
You must be signed in to change notification settings - Fork 493
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
GDCC/7527-fix-redetect #8835
GDCC/7527-fix-redetect #8835
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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). |
@@ -62,7 +63,7 @@ public DataFile execute(CommandContext ctxt) throws CommandException { | |||
} | |||
|
|||
logger.fine("target file: " + localFile); | |||
String newlyDetectedContentType = FileTypeDetection.determineFileType(localFile); | |||
String newlyDetectedContentType = FileUtil.determineFileType(localFile, fileToRedetect.getDisplayName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: