cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Get parent folder

Explorer | Level 3

In the project I make a simple file manager. I have to make a breadcrumbs. For this I need to be able to get a correct path to parent folder or an id of parent folder.
The issue is that I can not take this path from the path of current folder because the path of the current folder (that I get from Dropbox) often is not correct (it has lowercase letters in place of uppercase). If I want to get the metadata of file or folder by such path then Dropbox returns nothing. This is very strange (and bad) because you say that Dropbox is not sensetive to letters.
So I found solution. I get files and folders by there id.
But now I have another problem. How can I get the id of parent folder (I can not use path returned by Dropbox because it is wrong)?

1 Reply 1
Highlighted

Re: Get parent folder

Dropboxer
Dropboxer

Thanks for the post! Can you clarify what you mean when you say "the metadata of file or folder by such path then Dropbox returns nothing"? The Dropbox API is case-insensitive, so you should be able to query by path regardless of the case. If that's not working for you, please share the code you're using and the unexpected output.

 

For reference, Dropbox is case-insensitive, and attempts to be case-preserving, but sometimes you won't see the original expected case. You should use path_lower when performing operations, as that's the canonicalized version of the path. You should use path_display for display purposes, where the case will be preserved to the extent possible. Even in path_display though, the original casing isn't always available. There's a note about this in the API v2 documentation, under "Case insensitivity":

 

"Also, while Dropbox is case-insensitive, it makes efforts to be case-preserving. Metadata.name will contain the correct case. Metadata.path_display usually will contain the correct case, but sometimes only in the last path component. If your app needs the correct case for all components, it can get it from the Metadata.name or last path component of each relevant Metadata.path_display entry."

 

There's also some information in the documentation for "path_display" if you expand "FileMetadata", e.g., under /2/files/get_metadata. FileMetadata.name will contain the case-preserved name, so the workaround would be to build the path up from that.


We understand this is non-ideal of course, and I'll forward this on to the team as feedback, but I can't make any promises as to if or when this might be improved in the future.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?