consider files as XML, not SVG, if no .svg extension

This commit is contained in:
Ploum 2024-02-10 22:09:28 +01:00
parent 6ad59020a1
commit 36c9709bc4
2 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,7 @@
- opnk: added "--mode" command-line argument (bug #39)
- offpunk: support for "preformatted" theming (bug #38)
- opnk/netcache: added "--cache-validity" command-line argument (bug #37)
- ansicat: consider files as XML, not SVG, if they dont have .svg extension
## 2.1 - December 15th 2023
- freshly updated gemtext/rss links are highlighted ("new_link" theme option)

View File

@ -1355,6 +1355,9 @@ def get_mime(path,url=None):
# If its a xml file, consider it as such, regardless of what file thinks
elif path.endswith(".xml"):
mime = "text/xml"
# If it doesnt end with .svg, it is probably an xml, not a SVG file
elif "svg" in mime and not path.endswith(".svg"):
mime = "text/xml"
#Some xml/html document are considered as octet-stream
if mime == "application/octet-stream":
mime = "text/xml"