Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Brendan D.'s avatar
Brendan D.
Explorer | Level 4
11 years ago

Wrong character case of folder name when calling listFolder using Sync API

I'm traversing a folder hierarchy and have come across a strange anomaly in the letter case of one of my folders.

When I call listFolder to get the hierarchy of my folders, everything seems normal until it gets down to the third level.

For example, when I fetch the 2nd level in the hierarchy, I get the correct case for all my folders:

DBFileInfo(path='/Share/Attachments', isFolder=YES, modified=2015-02-02 10:43:24 +0000, size=0, thumbExists=NO, icon=folder),
DBFileInfo(path='/Share/Exports', isFolder=YES, modified=2015-02-02 10:43:55 +0000, size=0, thumbExists=NO, icon=folder),
DBFileInfo(path='/Share/Imports', isFolder=YES, modified=2015-02-02 10:43:55 +0000, size=0, thumbExists=NO, icon=folder)

But when I traverse into the /Share/Attachments folder (the 3rd level) and call listFolder again, this is what I get:

DBFileInfo(path='/share/Attachments/1EA9CC59-D0A8-4F82-8054-12DA1DC129C8', isFolder=YES, modified=2015-02-02 10:43:24 +0000, size=0, thumbExists=NO, icon=folder),

1EA9CC59-D0A8-4F82-8054-12DA1DC129C8 is just another level of folders. There are also files at this level too and it has the same issue.

DBFileInfo(path='/share/Attachments/20110131 Bloomberg HP.pdf', isFolder=NO, modified=1979-12-31 07:00:00 +0000, size=868025, thumbExists=NO, icon=page_white_acrobat),

If you notice, "/Share" is what it should be, but it's coming in as "/share" with a lowercase "s" when I fetch the 3rd level of items.

I'm simply calling this code:

NSArray* files = [fileSystem listFolder:path error:outError];

Where "path" = "/Share/Attachments"

Is this a bug on the Dropbox side or something wrong that I'm doing?

It may seem like a small thing, but I'm doing some string searching that's case sensitive and it's throwing off my code. I feel like I'm going to have to add a special case for this in code which will set the case back to "/Share" instead of "/share".

14 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    Unfortunately I don't have an update on if or when we'll be able to improve this on our side. Sorry I don't have anything better to share!

  • This specific thread is about the Sync API, which is deprecated, so we won't be making changes to it.

    More generally, /delta (API v1) and /files/list_folder (API v2) behave similarly in that only the last path segment is "correctly" cased (according to the current casing of the file). There are no immediate plans to change that, so my advice is to treat the Dropbox API as case-insensitive, since it is.

    For the scenario raised here, of trying to locate files on the local file system, the only good way to do this is to maintain your own mapping of lowercased paths to cased paths in the local file system. Because Dropbox itself is case insensitive, if we returned you a fully cased path, it may still not match the local file system. E.g. you wrote a file called Hello.txt and uploaded it to Dropbox as Hello.txt. The user then renamed it to HELLO.TXT. Now if the API told you the path was HELLO.TXT, you wouldn't be able to find the file on the local file system, where no such file exists. If instead, your app kept track of "Hello.txt is the local path for /hello.txt in Dropbox," there would be no such problem.

    So although we may revisit over time returning different information about the current casing of a file path in Dropbox, the fact that Dropbox itself is case-insensitive means that your app will need to maintain its own mapping when dealing with something like a case-sensitive file system.

  • testaccountprim's avatar
    testaccountprim
    New member | Level 1
    10 years ago

    Actually i have an sync app for dropbox api. When i put request for a folder named TEST, it replies with the content of folder named test ...(i know dropbox is case insensitive).but i need to resolve...either u have options ? or i have to handle this?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    Hi "testaccountprimary", this is an old thread about the Sync SDK in particular. It's unclear if that's what you're referring to, so please open a new thread with additional details so we can help you without spamming the other people on this thread. Thanks!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!