lib.Uri: Return 'file' scheme for local paths

The scheme property returns 'file://' for local paths instead of 'file', causing scheme_plus_authority to produce 'file://://' with a triple slash.

Also fix the test to expect 'file' instead of 'file://'.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.80.2
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-01 16:03:24 +02:00
commit 62803a4a1b
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 2 additions and 2 deletions

View file

@ -63,7 +63,7 @@ class Uri:
def scheme(self) -> str:
ret = self.__p.scheme
if not ret:
return 'file://'
return 'file'
return ret
@cached_property

View file

@ -19,7 +19,7 @@ assert '<hidden>' in u.safe_full_with_username # safe version hides password
# Scheme defaults to file
u = Uri('/local/path')
assert u.scheme == 'file://'
assert u.scheme == 'file'
assert u.protocol == 'file'
# Pimp returns existing Uri unchanged