datatracker icon indicating copy to clipboard operation
datatracker copied to clipboard

XML draft document isn't accepted by the datatracker with a complaint that the content is text/plain, despite .xml extension and form content type being text/xml

Open brong opened this issue 3 years ago • 2 comments

Describe the issue

Here's what's being submitted by the browser:

Content-Disposition: form-data; name="xml"; filename="draft-ietf-calext-vcard-jscontact-extensions.xml"
Content-Type: text/xml

And here's what the datatracker says:

Expected an XML file of type "application/xml" or "text/xml", found one of type "text/plain"

I'll attach the file if github allows

Code of Conduct

brong avatar Oct 24 '22 16:10 brong

Oh FFS Github won't let me attach a .xml file without renaming the content type. Here's the file renamed as .txt draft-ietf-calext-vcard-jscontact-extensions-xml.txt

brong avatar Oct 24 '22 16:10 brong

This is libmagic doing a surprising thing. We'll dig into it and see why. But at the moment, you can work around the mystery if you change the first line of the file from

<?xml version="1.0" encoding="utf-8"?>

to

<?xml version='1.0' encoding='utf-8'?>

rjsparks avatar Oct 24 '22 17:10 rjsparks

Right now, the datatracker checks a file with libmagic before continuing with with processing. It might be better to actually let lxml tell us it can't deal, to avoid silly issues like the above, but this will require thought to make sure we aren't opening ourselves to resource attacks as lxml tries to parse the input.

rjsparks avatar Nov 01 '22 17:11 rjsparks