flysystem-dropbox icon indicating copy to clipboard operation
flysystem-dropbox copied to clipboard

Dropbox is case insensitive

Open basz opened this issue 10 years ago • 5 comments

Dropbox is case insensitive. Meaning file/path created may be uppercased, but api queries are returned in lowercase.

Dropbox handles file paths in the same manner as Microsoft Windows. Uppercase and lowercase letters are preserved when creating files and folders, but are ignored when locating a file. For example: “AAA/file.txt” and “aaA/FILE>TXT” refer to the same file.

Dropbox/Client::getMetadataWithChildren will return lowercased paths.

And therefore calls to League\Flysystem\Filesystem::listContents('/aaA') may incorrectly fail if the path was created as '/aaa'.

basz avatar Mar 17 '15 14:03 basz

ping @frankdejonge

ghost avatar May 13 '15 02:05 ghost

@basz hmm, this one is tricky. I'm not sure how this should be solved within flysystem. Suggestions are welcome, I have to ponder on this one.

frankdejonge avatar May 13 '15 07:05 frankdejonge

I just ran into this issue. In my dropbox I had TestFolder which contained a couple of sub files and folders.

I could run listContents('TestFolder') and get back a list of the files and folders OK, but if I referenced a subfolder. Like listContents('TestFolder/Backups') then it would fail, because in the ContentListingFormatter it's checking for TestFolder/Backups but the api is returning testfolder/backups (not sure why the API returns TestFolder in the first call...).

Could paths passed (and directories) be lowercased, since the dropbox filesystem is Case insensitive? https://www.dropbox.com/developers-v1/core/bestpractices

Edit: For now I am just setting paths to lowercase before the call the Flysystem to access files and folder.

nfauchelle avatar Dec 21 '15 00:12 nfauchelle

As I understand this should be fixed by change all paths to lowercase, right? @frankdejonge strtolower() php function on all $path should fix this?

ghost avatar Dec 21 '15 02:12 ghost

I think, Reading my own first comment here that it is save for all querying api calls things should be lowercases (by the adapter). For any creational Api calls it should send as given by the end user.

Until then you can safely lowercase paths yourself.

basz avatar Dec 21 '15 09:12 basz