srackham/w3c-validator — pull request #4 by elmimmo (2014-04-21 19:52:59+00:00)
Title: Do not urlencode file path when input is local file

urlencoding the file path when using local files as input breaks the script:

$ w3c-validator.py --verbose "EPUB 2/OEBPS/part038.html"
validating: EPUB 2/OEBPS/part038.html ...
curl -sF "uploaded_file=@EPUB%202/OEBPS/part038.html;type=text/html" -F output=json http://validator.w3.org/check
Traceback (most recent call last):
File "/Users/jorge/bin/w3c-validator.py", line 81, in
result = validate(f)
File "/Users/jorge/bin/w3c-validator.py", line 56, in validate
raise OSError (status, 'failed: %s' % cmd)
OSError: [Errno 6656] failed: curl -sF "uploaded_file=@EPUB%202/OEBPS/part038.html;type=text/html" -F output=json http://validator.w3.org/check

Not doing so works fine:

$ w3c-validator.py --verbose "EPUB 2/OEBPS/part038.html"
validating: EPUB 2/OEBPS/part038.html ...
curl -sF "uploaded_file=@EPUB 2/OEBPS/part038.html;type=text/html" -F output=json http://validator.w3.org/check
{
"url": "part038.html",
"messages": [

],
"source": {
"encoding": "utf-8",
"type": "text/html"
}
}