diff --git a/changedetectionio/api/Watch.py b/changedetectionio/api/Watch.py index 9f5d0c82..5acc626f 100644 --- a/changedetectionio/api/Watch.py +++ b/changedetectionio/api/Watch.py @@ -447,6 +447,9 @@ class WatchFavicon(Resource): # Use cached MIME type detection filepath = os.path.join(watch.data_dir, favicon_filename) mime = get_favicon_mime_type(filepath) + if 'text' in mime: + logger.debug(f"Aborting favicon request for {filepath} because mimetype might be text (bad mimetype) '{mime}'") + abort(404) response = make_response(send_from_directory(watch.data_dir, favicon_filename)) response.headers['Content-type'] = mime diff --git a/changedetectionio/flask_app.py b/changedetectionio/flask_app.py index b1b1b0de..f8155f85 100644 --- a/changedetectionio/flask_app.py +++ b/changedetectionio/flask_app.py @@ -789,7 +789,11 @@ def changedetection_app(config=None, datastore_o=None): if favicon_filename: # Use cached MIME type detection filepath = os.path.join(watch.data_dir, favicon_filename) + mime = get_favicon_mime_type(filepath) + if 'text' in mime: + logger.debug(f"Aborting favicon request for {filename} because mimetype might be text (bad mimetype) '{mime}'") + abort(404) response = make_response(send_from_directory(watch.data_dir, favicon_filename)) response.headers['Content-type'] = mime