Open radfish opened 5 years ago
You may have already had that block, I'm not sure. However, while adding a file with an invalid path still works, trying to get that block now fails.
The issue here is that we don't actually look at the specified file when adding content. Instead, we read the content from the HTTP request.
So, to solve this, someone needs to make https://github.com/ipfs/go-unixfs/blob/master/importer/helpers/dagbuilder.go#L242 check the actual file data. However, doing that without repeatedly re-opening the file could be tricky.
Version information:
go-ipfs version: 0.4.19-dev-7ff5604a3 Repo version: 7 System version: amd64/linux Golang version: go1.11.5 custom build on top of 6a5a268514bf2671d6a364f0b3be8831f692e600
Type: bug
Description:
Server should return an error if the path passed in Abspath header is invalid, but it should. Instead the server adds the files to the blockstore, ignoring the nocopy argument, which is bad and confusing behavour.
Invalid path currently means: relative, non-existant, or not reachable from server's home directory, as far as my trials show. Btw, I think relative paths should be accepted if they are relative to the server's home directory, because the paths are already recorded in the filestore as relative to the server's home directory, but that merits a separate feature request issue.
Some error reporting has been added in #4558 but the case of this issue was not covered.
GOOD (good request, good result -- data added to filestore):
BAD (bad request, no error, added to blockstore instead of filestore):