Cannot request files beneath base. #6

Closed
allenap opened this Issue Jul 6, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

allenap commented Jul 6, 2012

FilesystemSynchronousBackend uses FilePath.child() to resolve the requested file to a file on disk. However, FilePath.child() rejects paths containing directory separators.

Owner

shylent commented Oct 4, 2012

I suppose, there will be no harm in allowing unlimited "downwards" traversal (that is allow requests of any files that are actually beneath base). The fix is really simple so all I need it to write a couple of tests for this new case and that's all.

@ghost ghost assigned shylent Oct 4, 2012

Owner

shylent commented Oct 4, 2012

On the second thought, though, what would one do when requesting a write to a directory that is beneath base, but which path contains fragment that don't exist on the file system. Say, base is /foo, which is an empty directory and one requests a write to /foo/bar/baz, which is "kind of" safe, but one expects from the backend in this case? To create missing fragments? Indicate an error ("File not found" or "Access violation" seem to be suitable error types)? I am not sure, to be honest

@allenap allenap referenced this issue Oct 4, 2012

Merged

Files beneath base #9

Contributor

allenap commented Nov 15, 2012

This change is opinionated in that regard: it creates those directories. A further change could make this configurable. We're only using the server for reads, so the write support for nested directories was done only for completeness; it wouldn't affect me to remove the makedirs() call and return an error instead.

@shylent shylent closed this Nov 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment