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

fix: content-type super-type resolution for application/octet-stream … #1137

Conversation

anto-ac
Copy link
Collaborator

@anto-ac anto-ac commented Jun 18, 2020

…is now correct

@@ -48,7 +48,7 @@ class ContentType(val contentType: MediaType?) {

fun isBinaryType(): Boolean {
return if (contentType != null) {
val superType = registry.getSupertype(contentType)
val superType = registry.getSupertype(contentType) ?: MediaType.OCTET_STREAM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/** * Returns the supertype of the given type. If the media type database * has an explicit inheritance rule for the type, then that is used. * Next, if the given type has any parameters, then the respective base * type (parameter-less) is returned. Otherwise built-in heuristics like * text/... -&gt; text/plain and .../...+xml -&gt; application/xml are used. * Finally application/octet-stream is returned for all types for which no other * supertype is known, and the return value for application/octet-stream * is <code>null</code>. * * @since Apache Tika 0.8 * @param type media type * @return supertype, or <code>null</code> for application/octet-stream */ public MediaType getSupertype(MediaType type) {

@aplsup
Copy link
Collaborator

aplsup commented Jun 18, 2020

LGTM 👍

@uglyog uglyog merged commit 152ecc1 into pact-foundation:master Jun 19, 2020
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.

4 participants