| Summary: | HostReachableValidator: encoding of URLs is broken | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Michael Ochmann <michael.ochmann> |
| Component: | Skalli | Assignee: | Project Inbox <skalli.core-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Michael Ochmann
* URLs entered for projects sometimes are "slightly" invalid, e.g. contain blanks in paths; browsers usually try to "sanitize" such URLs, and so should HostReachableValidator * encoding of URLs/URIs in Java is a mess: java.net.URI(String) accepts only 100% valid URIs, while java.net.URI(String, String,...) encodes path and query parameters; java.net.URL(String) happily accepts for example paths with blanks, and returns these paths with blanks * implemented a simple "sanitize" mechanism in URLUtils#stringToURL(): - first try java.net.URI(String) : if the string is a valid URI, just convert the URI to an URL and return it - if java.net.URI(String) throws an exception, try java.net.URL(String): if that fails too, then give up; otherwise construct a URI with ava.net.URI(String, String,...) and retrieve the necessary params from the URL: now they are properly encoded! - finally convert the URI back to an URL using URI#toAsciiString() https://git.eclipse.org/r/#/c/6844/ |