From c78cb113e3448227d864d9b98472fe12d11e4190 Mon Sep 17 00:00:00 2001 From: Gabriel Vasile Date: Mon, 30 Sep 2024 06:41:18 -0700 Subject: [PATCH] add application/xml as alias; close #227 (#581) According to RFC7303, text/xml is an alias to application/xml. But considering we we're using text/xml as the main mime type until now, changing to main=application/xml alias=text/xml would cause trouble to users. So for now, we're keeping as: main=text/xml alias=application/xml --- supported_mimes.md | 2 +- tree.go | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/supported_mimes.md b/supported_mimes.md index e6a65f6..042a5aa 100644 --- a/supported_mimes.md +++ b/supported_mimes.md @@ -147,7 +147,7 @@ Extension | MIME type | Aliases **.txt** | text/plain | - **.html** | text/html | - **.svg** | image/svg+xml | - -**.xml** | text/xml | - +**.xml** | text/xml | application/xml **.rss** | application/rss+xml | text/rss **.atom** | application/atom+xml | - **.x3d** | model/x3d+xml | - diff --git a/tree.go b/tree.go index d5a8667..aa7c8cd 100644 --- a/tree.go +++ b/tree.go @@ -76,18 +76,19 @@ var ( oggAudio = newMIME("audio/ogg", ".oga", magic.OggAudio) oggVideo = newMIME("video/ogg", ".ogv", magic.OggVideo) text = newMIME("text/plain", ".txt", magic.Text, html, svg, xml, php, js, lua, perl, python, json, ndJSON, rtf, srt, tcl, csv, tsv, vCard, iCalendar, warc, vtt) - xml = newMIME("text/xml", ".xml", magic.XML, rss, atom, x3d, kml, xliff, collada, gml, gpx, tcx, amf, threemf, xfdf, owl2) - json = newMIME("application/json", ".json", magic.JSON, geoJSON, har) - har = newMIME("application/json", ".har", magic.HAR) - csv = newMIME("text/csv", ".csv", magic.Csv) - tsv = newMIME("text/tab-separated-values", ".tsv", magic.Tsv) - geoJSON = newMIME("application/geo+json", ".geojson", magic.GeoJSON) - ndJSON = newMIME("application/x-ndjson", ".ndjson", magic.NdJSON) - html = newMIME("text/html", ".html", magic.HTML) - php = newMIME("text/x-php", ".php", magic.Php) - rtf = newMIME("text/rtf", ".rtf", magic.Rtf).alias("application/rtf") - js = newMIME("application/javascript", ".js", magic.Js). - alias("application/x-javascript", "text/javascript") + xml = newMIME("text/xml", ".xml", magic.XML, rss, atom, x3d, kml, xliff, collada, gml, gpx, tcx, amf, threemf, xfdf, owl2). + alias("application/xml") + json = newMIME("application/json", ".json", magic.JSON, geoJSON, har) + har = newMIME("application/json", ".har", magic.HAR) + csv = newMIME("text/csv", ".csv", magic.Csv) + tsv = newMIME("text/tab-separated-values", ".tsv", magic.Tsv) + geoJSON = newMIME("application/geo+json", ".geojson", magic.GeoJSON) + ndJSON = newMIME("application/x-ndjson", ".ndjson", magic.NdJSON) + html = newMIME("text/html", ".html", magic.HTML) + php = newMIME("text/x-php", ".php", magic.Php) + rtf = newMIME("text/rtf", ".rtf", magic.Rtf).alias("application/rtf") + js = newMIME("application/javascript", ".js", magic.Js). + alias("application/x-javascript", "text/javascript") srt = newMIME("application/x-subrip", ".srt", magic.Srt). alias("application/x-srt", "text/x-srt") vtt = newMIME("text/vtt", ".vtt", magic.Vtt)