diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Keep the charset off types that only spell xml
Matching xml anywhere in the type also caught the Office formats, whose
names hold openxmlformats, so a .docx went out with a UTF-8 charset.
Diffstat (limited to 'tests/t0105-plain.sh')
| -rwxr-xr-x | tests/t0105-plain.sh | 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 25 insertions, 0 deletions
diff --git a/tests/t0105-plain.sh b/tests/t0105-plain.sh index 4041d98..27e8daa 100755 --- a/tests/t0105-plain.sh +++ b/tests/t0105-plain.sh @@ -46,4 +46,29 @@ test_expect_success 'a blob whose bytes look binary is served as octet-stream' ' sed "/^$/q" tmp | grep "^Content-Type: application/octet-stream$" ' +# RFC 7303 names the XML types by an xml subtype or a +xml suffix, and those +# take a charset like text does. A type that only spells xml inside a word, +# as the Office formats do, is binary and gets none. +test_expect_success 'only text and xml types carry a charset' ' + ( + cd repos/foo && + printf "PK" >doc.docx && + printf "<svg/>" >pic.svg && + git add doc.docx pic.svg && + git commit -m types + ) && + docx=application/vnd.openxmlformats-officedocument. && + docx=${docx}wordprocessingml.document && + { + echo "enable-html-serving=1" && + echo "mimetype.docx=$docx" && + echo "mimetype.svg=image/svg+xml" && + cat cgitrc + } >typesrc && + CGIT_CONFIG="$PWD/typesrc" QUERY_STRING="url=foo/plain/doc.docx" cgit >tmp && + sed "/^$/q" tmp | grep "^Content-Type: $docx$" && + CGIT_CONFIG="$PWD/typesrc" QUERY_STRING="url=foo/plain/pic.svg" cgit >tmp && + sed "/^$/q" tmp | grep "^Content-Type: image/svg+xml; charset=UTF-8$" +' + test_done |
