Skip to content

Commit

Permalink
Closes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-goeldi committed Sep 21, 2023
1 parent c3b58d3 commit ab08f59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.d/34.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed default port creating faulty ws(s) url
17 changes: 10 additions & 7 deletions src/kweb/api/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ async def show_file(
case other:
raise HTTPException(status_code=406, detail=f"Unknown scheme {other}")

url = (
ws_scheme
+ (request.url.hostname or "localhost")
+ ":"
+ str(request.url.port)
+ root_path
)
if request.url.port is not None:
url = (
ws_scheme
+ (request.url.hostname or "localhost")
+ ":"
+ str(request.url.port)
+ root_path
)
else:
url = ws_scheme + (request.url.hostname or "localhost")

template_params = {
"request": request,
Expand Down

0 comments on commit ab08f59

Please sign in to comment.