apto / keydb

Key/value data/query API to use on the server or in the browser.
MIT License
1 stars 0 forks source link

ftp driver needs to resolve through soft links #4

Open darrencruse opened 10 years ago

darrencruse commented 10 years ago

When using the keydb ftp driver via the new jsDAV keydb backend, things are blowing up on files that are soft links.

e.g. when jsDAV attempted to 'get' the /tmp directory the ftp driver failed to return the contents of /tmp. It turned out to be because on Mac /tmp is actually a link to /private/tmp.

A change is needed within the keydb ftp driver so that it actually "follows" the links i.e. if the caller does a 'get' on /tmp it must recognize that it is a link and actually return the contents of what the link points to (/private/tmp).

Note the response message should still have the passed '/tmp' as the key however (in effect the caller of 'get' will not even know there was a link at all).

The "copy" and "move" commands should likewise follow links the same as "get".

Likewise the "meta" command should be giving the meta information of what the link points to. e.g. If the link points to a directory the "type" should be "collection" or if it points to a file the "size" should be the size of the file the link points to.

Stretch goal (discuss further if this turns out to be hard): Additionally "meta" should include a "link" attribute if the key is a link, whose value is the path to the linked file. "get"/"copy"/"move" don't need to include this, only "meta" (if there's a need to know if path is a link, people will have to do "meta").

darrencruse commented 10 years ago

I maybe should have clarified that this issue is magnified because when you do e.g. PROPFIND on /tmp/handler.js, the jsDAV code winds up doing a keydb (ftp driver) "get" on "/tmp".

So even though /tmp/handler.js is a file, the fact that /tmp is a softlink causes problems for accessing stuff below /tmp.

darrencruse commented 10 years ago

Sub had walked me through what he'd done towards this issue but I don't seem to see his changes in github. Sent him an email about it I'm wondering if he forgot to push it from his laptop to his branch...