-
Notifications
You must be signed in to change notification settings - Fork 238
Description
When a unixfs symlink is hit, if the mode is file (not block or car), gateway should emulate nginx and apache, that means resolve the symlink server side and return whatever file is being pointed to.
This proposal only targets relative symlinks (I have no idea what should happen with absolute ones).
To resolve it mean, take the current base path (the path of the folder containing the symlink).
Add the symlink path, do a lexical simplification (remove a/.. and . entries), and repeat the usual gateway process at that point.
Gateway MUST error if the lexical simplification errors (such as by a symlink having more .. than how deep it is in the dag).
Gateway MUST support recursively doing that (symlinks pointing to other symlinks). It MUST support a depth of at least 32, and SHOULD raise an error if number gets too big.
For example take this tree:
CID
+ a
| +- symlink (../b/example)
+ b
+- example
Loading CID/a/symlink the gateway would need to send the content of CID/b/example.
Because
First it resolve /a/symlink see that it's a symlink applies the content to the base path /a/../b/example
And then do a lexical simplification /b/example and then send this path content.