Skip to content

Commit

Permalink
fix redirect after poll
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Dec 4, 2023
1 parent 516ece1 commit ac73d9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/herald/templates/loading.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
</div>

<div hx-get="{{ url_for('view_poll', owner=owner, repo=repo, artifact_id=artifact_id) }}"
<div hx-get="{{ url_for('view_poll', owner=owner, repo=repo, artifact_id=artifact_id, file=file) }}"
hx-trigger="load"
hx-swap="outerHTML" style="display:none;">
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/herald/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ async def async_get_file() -> Tuple[IO[bytes], str]:
# abort(404)

@app.route("/poll/<owner>/<repo>/<int:artifact_id>")
@app.route("/view/<owner>/<repo>/<int:artifact_id>/<path:file>")
async def view_poll(owner: str, repo: str, artifact_id: int, path: str = ""):
@app.route("/poll/<owner>/<repo>/<int:artifact_id>/<path:file>")
async def view_poll(owner: str, repo: str, artifact_id: int, file: str = ""):
is_cached = gh.is_artifact_cached(f"{owner}/{repo}", artifact_id)
logger.debug(
"Polling for %s/%s #%d => %s, is cached: %s",
owner,
repo,
artifact_id,
path,
file,
is_cached,
)

Expand All @@ -304,11 +304,13 @@ async def view_poll(owner: str, repo: str, artifact_id: int, path: str = ""):
owner=owner,
repo=repo,
artifact_id=artifact_id,
file=path,
file=file,
)
},
)
poll_url = url_for("view_poll", owner=owner, repo=repo, artifact_id=artifact_id)
poll_url = url_for(
"view_poll", owner=owner, repo=repo, artifact_id=artifact_id, file=file
)

return f"""
<div hx-get="{poll_url}" hx-trigger="load delay:2s" hx-swap="outerHTML" style="display:none;"></div>
Expand Down

0 comments on commit ac73d9d

Please sign in to comment.