Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

There seems to be an issue uploading files with non-ascii character in their names #30

@k8n

Description

@k8n

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions