mirror of
				https://github.com/Garmelon/PFERD.git
				synced 2025-10-31 21:02:42 +01:00 
			
		
		
		
	Fix HTML file downloading
Previously PFERD thought any HTML file was a "Error, no access" page when downloading. Now it checks whether ILIAS sends a content-disposition header, telling the browser to download the file. If that is the case, it was just a HTML file uploaded to ILIAS. If it has no header, it is probably an error message.
This commit is contained in:
		| @@ -139,8 +139,9 @@ class IliasDownloader: | ||||
|  | ||||
|         with self._session.get(url, stream=True) as response: | ||||
|             content_type = response.headers["content-type"] | ||||
|             has_content_disposition = "content-disposition" in response.headers | ||||
|  | ||||
|             if content_type.startswith("text/html"): | ||||
|             if content_type.startswith("text/html") and not has_content_disposition: | ||||
|                 if self._is_logged_in(soupify(response)): | ||||
|                     raise ContentTypeException("Attempting to download a web page, not a file") | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 I-Al-Istannen
					I-Al-Istannen