fix url_for no allowing query params

This commit is contained in:
Tiago vasconcelos 2021-11-17 12:56:43 +00:00
parent e8882645c4
commit 2485e8eabf
2 changed files with 6 additions and 5 deletions

View File

@ -36,8 +36,8 @@ async def get_livestream(ls_id: int) -> Optional[Livestream]:
async def get_livestream_by_track(track_id: int) -> Optional[Livestream]:
row = await db.fetchone(
"""
SELECT livestreams.* FROM livestream.livestreams
INNER JOIN tracks ON tracks.livestream = livestreams.id
SELECT livestreams.* AS livestreams FROM livestream.livestreams
INNER JOIN livestream.tracks AS tracks ON tracks.livestream = livestreams.id
WHERE tracks.id = ?
""",
(track_id,),

View File

@ -75,10 +75,11 @@ class Track(BaseModel):
if not self.download_url:
return None
url = request.url_for("livestream.track_redirect_download", track_id=self.id)
url_with_query = f"{url}?p={payment_hash}"
return UrlAction(
url=request.url_for(
"livestream.track_redirect_download", track_id=self.id, p=payment_hash
),
url=url_with_query,
description=f"Download the track {self.name}!",
)