Skip to content
Merged
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
2 changes: 1 addition & 1 deletion addOns/spider/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased
### Fixed
- Do not warn when canonicalising apparent URI, `//`.
- Do not warn when canonicalising apparent URI, `//`, nor empty `tel` and `mailto`.

## [0.16.0] - 2025-09-02
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ private UrlCanonicalizer() {}
* @return the canonical url
*/
public static String getCanonicalUrl(ParseContext ctx, String url, String baseURL) {
if (StringUtils.startsWithIgnoreCase(url, "javascript:") || "//".equals(url)) {
if (StringUtils.startsWithIgnoreCase(url, "javascript:")
|| StringUtils.startsWithIgnoreCase(url, "tel:")
|| StringUtils.startsWithIgnoreCase(url, "mailto:")
Comment on lines +90 to +91
Copy link
Member

Choose a reason for hiding this comment

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

startsWith or equals?

Copy link
Member Author

Choose a reason for hiding this comment

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

Scheme is case insensitive and we don't want any tel/mailto (they were already being ignored when they had values just not empty).

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, my question was whether we should use equalsIgnoreCase intead of startsWithIgnoreCase. I wasn't aware that they were already being ignored with values. Makes sense to exist early.

|| "//".equals(url)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ void shouldNormaliseEmptyAndDotPathSegmentsWhenCanonicalizing() {
"javascript:",
"javascript://Something",
"javascript:ignore()",
"mailto:",
"mailto:[email protected]",
"tel:",
"tel:+1-900-555-0191"
})
void shouldIgnoreURIsWithNoAuthority(String uri) {
Expand Down