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

Xml content type fix #760

Closed
wants to merge 4 commits into from
Closed

Xml content type fix #760

wants to merge 4 commits into from

Conversation

ChristophKronberger
Copy link

Alternative soloution to
#725

We split the content type header with ";" and get rid off the charset and additional boundary Part.
We check for "endswith" xml instead of "contains" so we avoid to set application/vnd.openxmlformats-officedocument. wordprocessingml.document as a valid Type.

Tested and works fine

Relates to #721

@@ -628,7 +630,15 @@ public void setEditable(boolean enabled) {

@Override
public int getSupportScoreForContentType(String contentType ) {
return contentType.toLowerCase().endsWith("xml")? 2 : 0;
if(contentType.endsWith("xml")){
Copy link
Author

Choose a reason for hiding this comment

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

this is the standard behaviour for application/xml or else.

if(contentType.endsWith("xml")){
return 2;
}
Optional<String> any = Arrays.stream(contentType.split(";"))
Copy link
Author

Choose a reason for hiding this comment

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

If there is other stuff like charset or boundard or both, we get rid of that and do the check again.

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.

None yet

2 participants