From ae4dc77bba4a07610a3c2622129fc8b833e059aa Mon Sep 17 00:00:00 2001 From: cwilvx Date: Wed, 19 Jun 2024 14:57:47 +0300 Subject: [PATCH] rename legacy endpoint --- app/api/stream.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/stream.py b/app/api/stream.py index ccc030cf..d5a79535 100644 --- a/app/api/stream.py +++ b/app/api/stream.py @@ -23,8 +23,8 @@ class SendTrackFileQuery(BaseModel): ) -@api.get("//classic") -def send_track_file_classic(path: TrackHashSchema, query: SendTrackFileQuery): +@api.get("//legacy") +def send_track_file_legacy(path: TrackHashSchema, query: SendTrackFileQuery): """ Get a playable audio file without Range support @@ -49,7 +49,7 @@ def send_track_file_classic(path: TrackHashSchema, query: SendTrackFileQuery): if track_exists: audio_type = get_mime(filepath) - return send_file(filepath, mimetype=audio_type) + return send_file(filepath, mimetype=audio_type, conditional=True) # Else, find file by trackhash tracks = TrackStore.get_tracks_by_trackhashes([trackhash]) @@ -61,7 +61,7 @@ def send_track_file_classic(path: TrackHashSchema, query: SendTrackFileQuery): audio_type = get_mime(track.filepath) try: - return send_file(track.filepath, mimetype=audio_type) + return send_file(track.filepath, mimetype=audio_type, conditional=True) except (FileNotFoundError, OSError) as e: return msg, 404