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

Fixing the content-type check for XML. #725

Open
wants to merge 4 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bin/soapui-5.7.0.jar
Binary file not shown.
Binary file added bin/soapui-5.7.0.zip
Binary file not shown.
Binary file added bin/soapui_fix.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ public void setEditable(boolean enabled) {

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

Choose a reason for hiding this comment

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

Isn't that dangerous, since it will also include content types that are not necessarily supported?
For example: application/ vnd.openxmlformats-officedocument. wordprocessingml.document which is the MIME-Type of a MS Word .docx file.

Copy link
Author

Choose a reason for hiding this comment

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

@wilk-polarny This is a score to indicate which tab to choose when the response comes. You can switch to XML tab manually anyway. So, this is not a security measure against an invalid content. The main purpose is to open xml tab when the xml has come in response. The current issue is that the hint is not working.

Choose a reason for hiding this comment

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

I agree that the current proposal is sufficient, but if the hold-up is because of how open-ended it is, we could tighten it up by checking to see if it ends in "xml" or if it contains "/xml;". A regular expression such as the following would work: (?:(xml$)|(/xml;.+)) It is unclear to me--is the "WhiteSource Configuration Change" issue still outstanding?

Copy link
Author

Choose a reason for hiding this comment

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

@dmccarty-incomm The issue is that the maintainers do not process the merge requests. Whitesource validation failure is a minor issue which can be resolved easilly as well.

Choose a reason for hiding this comment

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

How about split by ";" and check it?

text/xml;charset=UTF-8

[0] text/xml  -> endsWith xml -> stop checking
[1] charset=UTF-8

}

protected ValidationError[] validateXml(String xml) {
Expand Down