Skip to content

Commit

Permalink
Comment on URL normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed Aug 14, 2021
1 parent 6b3ec64 commit a909600
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/jsoup/internal/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ public static URL resolve(URL base, String relUrl) throws MalformedURLException
* @return an absolute URL if one was able to be generated, or the empty string if not
*/
public static String resolve(final String baseUrl, final String relUrl) {
URL base;
try {
URL base;
try {
base = new URL(baseUrl);
} catch (MalformedURLException e) {
Expand All @@ -299,7 +299,8 @@ public static String resolve(final String baseUrl, final String relUrl) {
}
return resolve(base, relUrl).toExternalForm();
} catch (MalformedURLException e) {
// it may still be valid, just that Java doesn't have a registered stream handler for it, e.g. tel:
// it may still be valid, just that Java doesn't have a registered stream handler for it, e.g. tel
// we test here vs at start to normalize supported URLs (e.g. HTTP -> http)
return validUriScheme.matcher(relUrl).find() ? relUrl : "";
}
}
Expand Down

0 comments on commit a909600

Please sign in to comment.