mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-08 09:30:40 +01:00
Add x-filename-b64 header
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from base64 import b64decode
|
||||
from typing import Optional
|
||||
|
||||
import httpx
|
||||
@@ -28,8 +29,7 @@ async def download(
|
||||
await client.aclose()
|
||||
return None
|
||||
|
||||
content_disposition = response.headers["Content-Disposition"]
|
||||
name = content_disposition.replace("attachment; filename=", "")
|
||||
name = b64decode(response.headers["x-filename-b64"]).decode()
|
||||
|
||||
return response, client, name
|
||||
|
||||
@@ -47,4 +47,4 @@ async def get_filename(book_id: int, file_type: str) -> Optional[str]:
|
||||
if response.status_code != 200:
|
||||
return None
|
||||
|
||||
return response.text.encode("ascii", "ignore").decode("ascii")
|
||||
return response.text
|
||||
|
||||
Reference in New Issue
Block a user