Skip to content

Keep blogroll links to web and relative URLs - #221

Open
snoopdave wants to merge 2 commits into
roller-6.1.xfrom
blogroll-link-urls
Open

snoopdave wants to merge 2 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.

/**
* Returns the value if it is an absolute http or https URL, else null.
*/
static String webLinkOrNull(String value) {

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.

Important: webLinkOrNull silently drops any outline whose URL fails URI parsing — including ordinary human URLs with unencoded spaces (http://example.com/a b, covered by the new test). Whole bookmarks vanish from the import with no feedback to the user beyond a debug-level log. Consider at least logging the drop at WARN with the outline name, and a CHANGES.md note that OPML entries are now kept only when their htmlUrl/xmlUrl are absolute http(s) URLs, so users understand why previously-importable entries disappear.

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.

🤖Claude: fixed by logging each skipped outline at WARN with its name and URL (and a WARN when only the feed URL is dropped), plus a CHANGES.md entry (cb1ec31).

@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).

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.

1 participant