Fix: Custom filesystem exception for invalid ciphertext nodes #286
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.
This PR changes an error behavior of the filesystem.
On the encrypted/ciphertext side, Cryptofs can represent decrypted/cleartext filenodes either as single files or directories. In the latter case the directory must contain any identification files in order to be recognized. (dir.c9r, symlink.c9r, etc)
In the current version, if such a file was not present, a
NoSuchFileExceptionis thrown. But this exception does not represent the actual state of the filesystem node: Instead of not being present, it is broken. And with the wrong exception library consumer might be tempted to use the "free" path, albeit it is not, only running into the next exception.I replaced the wrong exception with a new, custom
FileSystemException: InvalidFileNodeException. The consumer does not know about it and recieves ultimately a generic IOException, indicating there is something wrong with the filesystem node.