Skip to content

Commit

Permalink
Merge pull request #7 from uni-halle/fileExtensionFix
Browse files Browse the repository at this point in the history
Reworked getting file extension
  • Loading branch information
vJan00 authored Jan 17, 2024
2 parents c77f43b + dd6b63b commit 8d9f24c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/core/TsApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ def add_link_to_queue(self, uid: str, link: str, username: str,
if username and password:
session.auth = (username, password)
response = session.get(link, allow_redirects=False)
ext = response.headers.get("Content-Disposition").split(".")[-1]
if response.status_code != 200:
raise Exception
file = FileStorage(
stream=io.BytesIO(response.content),
filename=uid + "." + ext,
filename=uid + "." + link.split(".")[-1],
content_length=response.headers.get("Content-Length"),
content_type=response.headers.get("Content-Type")
)
Expand Down

0 comments on commit 8d9f24c

Please sign in to comment.