Skip to content

fix(index): skip indented comment lines in WebSource url files - #169

Open
longzhenren wants to merge 1 commit into
StarTrail-org:mainfrom
longzhenren:fix/web-source-indent-comment
Open

longzhenren wants to merge 1 commit into
StarTrail-org:mainfrom
longzhenren:fix/web-source-indent-comment

Conversation

@longzhenren

Copy link
Copy Markdown

Root cause

WebSource.__init__ parsed url files with:

if line.strip() and not line.startswith("#")

The emptiness check used the stripped line but the comment check used the raw line, so a comment with leading whitespace or a tab was treated as a URL and entered the render/index pipeline.

Repro on main:

# urls file: "https://a.com\n  # indented comment\n"
# before: ["https://a.com", "# indented comment"]
# after:  ["https://a.com"]

Fix

Strip each line once and apply both checks to the cleaned value (walrus in the comprehension).

Test

Added tests/test_web_source_urls.py covering plain URLs, indented/tab comment lines, blank and full-line comments, and whitespace stripping.

The emptiness check used the stripped line while the comment check used
the raw line, so indented or tab-prefixed comments were collected as
URLs. Strip each line once and apply both checks to the cleaned value.
@vercel

vercel Bot commented Oct 2, 2026

Copy link
Copy Markdown

@longzhenren is attempting to deploy a commit to the andylizf's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant