mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Add more allowed file types
This commit is contained in:
parent
9a4ab645dc
commit
c824ae4f6d
@ -31,6 +31,15 @@ class ShibbolethAuthenticator:
|
||||
RETRY_DELAY = 1 # seconds
|
||||
CHUNK_SIZE = 1024**2
|
||||
|
||||
ALLOWED_CONTENT_TYPES = [
|
||||
"application/pdf",
|
||||
"application/zip",
|
||||
"text/xml",
|
||||
"text/plain",
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
]
|
||||
|
||||
def __init__(self, cookie_path=None):
|
||||
self._cookie_path = cookie_path
|
||||
|
||||
@ -185,7 +194,7 @@ class ShibbolethAuthenticator:
|
||||
for t in range(self.RETRY_ATTEMPTS):
|
||||
try:
|
||||
async with self._session.get(url, params=params) as resp:
|
||||
if resp.content_type in ["application/pdf", "application/zip", "text/xml"]:
|
||||
if resp.content_type in self.ALLOWED_CONTENT_TYPES:
|
||||
# Yay, we got the file (as long as it's a PDF)
|
||||
await utils.stream_to_path(resp, to_path)
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user