Skip to content

Commit 715caa0

Browse files
committed
fix: pass http(s) URLs directly to devices instead of proxying
This fixes a regression introduced with S3 support where external http(s) URLs were always proxied through goosebit. For http(s) URLs, the original URL is now passed directly to the device, which: - Preserves credentials in the URL - Allows relative path resolution (e.g. for casync directories) For s3:// and file:// URIs, the download endpoint is still used. Fixes #399
1 parent b41c165 commit 715caa0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

goosebit/updates/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,14 @@ async def generate_chunk(request: Request, device: Device) -> list[UpdateChunk]:
9898
if software is None:
9999
return []
100100

101-
# Always use the download endpoint for consistency, the endpoint
102-
# will handle both local and remote files appropriately.
103-
href = str(request.url_for("download_artifact", dev_id=device.id))
101+
# For remote http(s) URLs, pass the original URL directly to the device.
102+
# This preserves credentials in the URL and allows relative path resolution (e.g. for casync).
103+
# For s3:// or file:// URIs, use the download endpoint which handles proxying.
104+
parsed_uri = urlparse(software.uri)
105+
if parsed_uri.scheme in ("http", "https"):
106+
href = software.uri
107+
else:
108+
href = str(request.url_for("download_artifact", dev_id=device.id))
104109

105110
return [
106111
UpdateChunk(

0 commit comments

Comments
 (0)