tballison commented on PR #3142:
URL: https://github.com/apache/tika/pull/3142#issuecomment-5590936152
Thank you for opening this!
In looking at the codebase, I realize that we let duplicative call sites
arise, which we shouldn't have.
EmbeddedDocumentUtil.getExtensionForMediaType(String) already basically does
what FileNameUtils does, with some difference input and default missing value.
We should put this functionality in one, along the lines of:
```
public static String calculateExtension(Metadata metadata, String
defaultValue) {
String ext = EmbeddedDocumentUtil.getExtensionForMediaType(
metadata.get(HttpHeaders.CONTENT_TYPE));
return StringUtils.isBlank(ext) ? defaultValue : ext;
}
```
Perhaps on a follow on PR, put `public String getExtension(String name) {}
in MimeTypes and then call from there?
Consider deprecating the two current call sites that are nearly duplicative?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]