Skip to content

Conversation

@ibalosh
Copy link

@ibalosh ibalosh commented Jan 17, 2026

ref https://linear.app/ghost/issue/BER-3137

The GS030-ASSET-REQ check was incorrectly flagging external script tags with absolute URLs (e.g. https://example.com/assets/script.js) as needing the {{asset}} helper.

The {{asset}} helper is only meant for relative theme assets - using it with an absolute URL would produce an incorrect path like /assets/https://example.com/...

Updated the regex to use a negative lookahead that excludes URLs starting with http://, https://, or // (protocol-relative).

@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2026

Walkthrough

This change updates the GS030-ASSET-REQ regex to exclude external asset URLs by adding a negative lookahead that skips src/href values starting with http://, https://, or //. A new test and fixture verify that absolute URLs containing /assets/ do not trigger the GS030-ASSET-REQ warning (GS030-ASSET-SYM remains covered).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the bug fix - excluding external URLs from the asset helper warning by updating the regex with negative lookahead.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the bug fix, references the issue tracker, describes the problem with external URLs being incorrectly flagged, and details the regex solution implemented.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ibalosh ibalosh changed the title 🐛 Fixed asset helper warning for absolute URLs 🐛 Fixed asset helper warning for external script tag with absolute URLs Jan 17, 2026
@ibalosh ibalosh self-assigned this Jan 17, 2026
@ibalosh ibalosh force-pushed the absolute-url-assets-fix branch 4 times, most recently from 0dc59bf to c290841 Compare January 17, 2026 11:17
ref https://linear.app/ghost/issue/BER-3137

The GS030-ASSET-REQ check was incorrectly flagging external scripts and
stylesheets with absolute URLs (e.g. https://example.com/assets/script.js)
as needing the {{asset}} helper. The {{asset}} helper is only meant for
relative theme assets - using it with an absolute URL would produce an
incorrect path like /assets/https://example.com/...

Updated the regex to use a negative lookahead that excludes URLs starting
with http://, https://, or // (protocol-relative).
@ibalosh ibalosh force-pushed the absolute-url-assets-fix branch from c290841 to 27447a6 Compare January 17, 2026 11:17
@cathysarisky cathysarisky removed their request for review January 17, 2026 12:47
@cathysarisky
Copy link
Member

Hi @ibalosh !

I don't have visibility to the linked Linear issue, and this feels out of scope for the unpaid work I contribute to Ghost, so I'm going to unassign, guessing it was just an error and you meant to ask someone else.

Whenever my paying work leaves time, I'm happy to review PRs that fix an issue I submitted, that specifically impact self-hosters, or that impact something I've worked on (enhanced editors, i18n, etc).

Have a great one! 😄

@ibalosh
Copy link
Author

ibalosh commented Jan 18, 2026

Hi @cathysarisky

Thanks for letting me know, totally understood, mistake on my side.
Appreciate the clarification, and have a great day! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants