Skip to content

Keep blogroll links to web and relative URLs - #221

Merged
snoopdave merged 5 commits into
roller-6.1.xfrom
blogroll-link-urls
Oct 30, 2026
Merged

snoopdave merged 5 commits into
roller-6.1.xfrom
blogroll-link-urls

Conversation

@snoopdave

Copy link
Copy Markdown
Contributor

Blogroll links are kept to web and relative URLs:

  • OPML import keeps a bookmark's link and feed URL only when they are absolute http or https URLs.
  • Templates get bookmark URLs through WeblogBookmarkWrapper only when they are relative or use http, https, ftp or mailto, so links stored by earlier imports are covered too.
  • The blogroll macro in weblog.vm escapes the URLs it prints in attributes.

Tests: BookmarkImportParsingTest (import keeps only web links) and WeblogBookmarkWrapperTest. Full build and tests pass on JDK 11.

OPML import keeps only absolute http and https links. Templates get bookmark URLs through the wrapper only when they are relative or use http, https, ftp or mailto, so links stored earlier are covered too. The blogroll macro escapes the URLs it prints in attributes.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤖 GLM: PR-Review — 1 inline comment posted.

@snoopdave

Copy link
Copy Markdown
Contributor Author

🤖 GLM: PR-Review — General Issues

The following issues were found but cannot be attached to a specific line in the diff:

Strengths worth noting (not action items): the two-layer approach (import-time validation plus the wrapper's scheme allow-list for stored values) covers data written before this change, and webLinkOrNull requiring a host is a nice strictness touch; the new tests cover both layers.

@snoopdave

Copy link
Copy Markdown
Contributor Author

🤖Claude: fixed by adding a CHANGES.md entry under 6.1.7 behaviour changes (cb1ec31).

@mraible mraible left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I checked the import, display and manual-entry paths. Manual entry is already limited to http(s)/ftp by the Struts url validator, and the template now escapes the hrefs. LGTM, with one optional note inline.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good direction. Some improvements inline. One more: a Velocity test that renders #showBookmarkLinksList with a bookmark whose URL contains " and whose name contains <b> would cover the macro escaping end to end; today only the wrapper and import are tested.

Import and display now share LinkScheme, which reads a link's scheme the
way a browser does and refuses a link with '&' before the path. Import no
longer drops links that java.net.URI rejects but browsers accept. The
blogroll macro escapes bookmark names and descriptions, and a duplicate
#if branch is gone.
@snoopdave

Copy link
Copy Markdown
Contributor Author

🤖Claude: not fixed — the macro rendering test from the review summary. Rendering #showBookmarkLinksList needs a test that loads weblog.vm with a weblog, folder and bookmarks; that is a larger change than this round. The escaping itself is in 18b432d.

@snoopdave
snoopdave merged commit 931161e into roller-6.1.x Oct 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants