This repository was archived by the owner on Feb 12, 2024. It is now read-only.
feat: better error message on ipfs cat#1965
Closed
niinpatel wants to merge 1 commit intoipfs:masterfrom
Closed
Conversation
`ipfs cat <hash>/wrong-dir/wrong-file` previously returned: 'No such file'. this commit changes the error message to: 'no file named "wrong-dir/wrong-file" under <hash>' License: MIT Signed-off-by: Nitin Patel <nitinpatel278@gmail.com>
7c0401f to
8535232
Compare
alanshaw
suggested changes
Apr 4, 2019
| pull( | ||
| exporter(ipfsPath, self._ipld, options), | ||
| pull.filter(file => file.path === fileNameOrHash), | ||
| exporter(cid, self._ipld, options), |
Member
There was a problem hiding this comment.
If you export the CID not CID+path you'll have to traverse through the entire graph until you get to the path you were looking for. This could make cat VERY slow for big directories if the content is not in your repo already (and be slow anyway, even if it is).
cc @achingbrain
Member
There was a problem hiding this comment.
+1 that - if you pass the path as well as the CID (e.g. /ipfs/Qmfoo/path/to/file.txt) the the unixfs exporter is smart enough to not load whole DAGs for sharded directories, etc which saves a load of time & bandwidth. Maybe this change is better made there?
Member
|
Closing as this needs a better approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves: #1145
The command
ipfs cat <hash>/wrong-dir/wrong-filepreviously returned error message:
No such fileFollowing the suggestions given in this thread, I changed the error message to:
no file named "wrong-dir/wrong-file" under <hash>Also, the CI check will fail because test case for this is in interface-ipfs-core. So we'll need to change the tests in interface-ipfs-core repo.