Skip to content

Fix: In furl/furl.py, the origin property (~line 1540) unconditionally... - #200

Open
M001N wants to merge 1 commit into
gruns:masterfrom
M001N:oss-engine/bfbdc823-950a5c31
Open

Fix: In furl/furl.py, the origin property (~line 1540) unconditionally...#200
M001N wants to merge 1 commit into
gruns:masterfrom
M001N:oss-engine/bfbdc823-950a5c31

Conversation

@M001N

@M001N M001N commented Aug 17, 2026

Copy link
Copy Markdown

Summary

Added an early return in the origin property: if both scheme and host are empty, return '' instead of formatting the '://' template. The origin.setter and all other call sites (e.g. url composition using scheme+host+port directly, not origin) are unaffected; normal furls with scheme+host still produce the same origin string as before.

Problem

gruns/furl issue reference: #112

Root Cause

In furl/furl.py, the origin property (~line 1540) unconditionally formats '%s://%s%s' % (scheme, host, port) using self.scheme or '' and idna_encode(self.host) or ''. When a furl has neither scheme nor host (e.g. furl('www.google.com'), which furl parses as a schemeless, hostless path), both substitutions are empty strings, so the format always yields the literal '://' instead of a sensible empty/falsy value.

Testing

PASS - 70 passed, 3 deselected (test_netloc, test_hosts, test_odd_urls are pre-existing unrelated IPv6/path-edge-case failures on this environment, confirmed failing identically before this change; test_origin passes including new assertions for furl.furl().origin == '' and furl.furl('www.google.com').origin == ''.

Related Issue

#112

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