Skip to content

fix: use correct operator precedence in URL construction#100

Merged
Kyrela merged 1 commit intoKyrela:mainfrom
rileychh:fix-url-construction
Mar 22, 2026
Merged

fix: use correct operator precedence in URL construction#100
Kyrela merged 1 commit intoKyrela:mainfrom
rileychh:fix-url-construction

Conversation

@rileychh
Copy link
Contributor

When HTTP support was added (d193310), a regression was introduced that caused all HTTPS URLs to return only https without the rest of the URL:

[Threads](<https>) • [@***](<https***>) • [FixThreads](https)

This is caused by Python's operator precedence — + binds tighter than the ternary if/else, so:

"https" if self.is_ssl else "http"
+ "://{domain}"
+ route_repl

evaluates as:

"https" if self.is_ssl else ("http" + "://{domain}" + route_repl)

Since is_ssl defaults to True for all websites, get_repl() always returns just "https".

The fix adds parentheses around the ternary expression:

("https" if self.is_ssl else "http")
+ "://{domain}"
+ route_repl

@Kyrela Kyrela merged commit e12931c into Kyrela:main Mar 22, 2026
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2026
@Kyrela
Copy link
Owner

Kyrela commented Mar 22, 2026

I'm dumb af, thanks for this fix!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants