This repository was archived by the owner on Dec 22, 2023. It is now read-only.
Description Here is a trace (upload_file executed via box.py) that fails with "status":400,"code":"invalid_request_parameters":
POST /api/2.0/files/content HTTP/1.1
Host: upload.box.com
Content-Length: 47237
Accept-Encoding: gzip, deflate, compress
Accept: */*
User-Agent: python-requests/2.2.1 CPython/2.7.5 Darwin/13.1.0
Content-Type: multipart/form-data; boundary=c5a8408bda51429ba5871377731fc678
Authorization: Bearer ACCESS_TOKEN
--c5a8408bda51429ba5871377731fc678
Content-Disposition: form-data; name="parent_id"
1673257278
--c5a8408bda51429ba5871377731fc678
Content-Disposition: form-data; name*=utf-8''S%C3%A9vigny.pdf; filename*=utf-8''S%C3%A9vigny.pdf
Here is a trace from an equivalent openration via curl:
0000: POST /api/2.0/files/content HTTP/1.1
0026: User-Agent: curl/7.30.0
003f: Host: upload.box.com
0055: Accept: */*
0062: Authorization: Bearer ACCESS_TOKEN
009a: Content-Length: 43177
00b1: Expect: 100-continue
00c7: Content-Type: multipart/form-data; boundary=--------------------
0107: --------37edc5e8d7c9
011d:
<= Recv header, 23 bytes (0x17)
0000: HTTP/1.1 100 Continue
=> Send data, 161 bytes (0xa1)
0000: ------------------------------37edc5e8d7c9
002c: Content-Disposition: form-data; name="filename"; filename="Se..v
006c: igny.pdf"
0077: Content-Type: application/octet-stream
009f:
=> Send data, 16384 bytes (0x4000)
Seems Box Content API is not liking RFC 2231 -encoded file names. More related discussion on this. And a hack-around ?
I'm not sure yet what to tell requests library to send filename unencoded.
Reactions are currently unavailable