cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Upload/Download files with non-printable char

Upload/Download files with non-printable char

hhting
Explorer | Level 4

Hi,

We use following apis to perform file upload/download, and passing filename in Dropbox-API-Arg header.

If the filename contains non-printable char (ascii < 32), we encode them using unicode. (according to this encoding doc)

However, this method is only valid for uploading files, downloading files will result in a malformed path error.

How can we properly encode filenames with non-printable char?

 

APIs

- https://content.dropboxapi.com/2/files/download

- https://content.dropboxapi.com/2/files/upload

 

2 Replies 2

Здравко
Legendary | Level 20

@hhting wrote:

...

If the filename contains non-printable char (ascii < 32), we encode them using unicode. (according to this encoding doc)

...


Hi @hhting,

Since Dropbox API uses JSON encoding (RFC4627), you need to encode all codepoints < 32, as described in documentation:


...

The representation of strings is similar to conventions used in the C
family of programming languages. A string begins and ends with
quotation marks. All Unicode characters may be placed within the
quotation marks except for the characters that must be escaped:
quotation mark, reverse solidus, and the control characters (U+0000
through U+001F).


By the way, in spite supported by API, it's never good idea such chars to be used since may make Dropbox application confusion (and usually do) - as seems Dropbox application coders are newbee. If possible, try avoid them.

 


@hhting wrote:

...

However, this method is only valid for uploading files, downloading files will result in a malformed path error.

...


Can you give some examples of such calls that are able to upload something, but while you use the same name/path, they cannot get it back? 🤔 What's the exact name?

hhting
Explorer | Level 4

Hi Здравко,
We noticed that there are some bugs in our encoding mechanism. We will fix them and see if the problem still exists.
Thanks

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    hhting Explorer | Level 4
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?