-
-
Notifications
You must be signed in to change notification settings - Fork 76
Description
On numerous occasions, TL;DR has accepted a merge request which doesn't follow the required directory structure.
The most recent example is accepting a file under /pages.es/common/asar.md/asar.md
. When this happens, I would expect the client to continue to handle updates gracefully. This way, when the issue is resolved, users can get an update to the fixed version.
In this instance, it impacted a user that asked a question in our Matrix chat room with the following issue:
Error: EISDIR: illegal operation on a directory, unlink '/home//.tldr/cache/pages.es/common/asar.md'
Expected behavior
Verify integrity
The update flow could have an intermediate step to "verify file integrity", whenever an update is fetched.
When grabbing the zip file, store and extract the contents in a separate directory and make sure the directory structure looks as expected before overwriting the real cache.
When pulling from the git repo, store the last good commit hash, and after pulling if the directory structure looks off, reset back.
Clear Cache on Error
If a non-network related error occurs during an update, instruct the user to try to invalidate the cache and try again. (We shouldn't do this automatically, or at least not without doing a HEAD
request to the download location to ensure we can connect to it.)
Actual behavior
If the user performs an update and gets a bad version of tldr-pages, the update command stops working.
Log, debug output
Error: EISDIR: illegal operation on a directory, unlink '/home/<user-name>/.tldr/cache/pages.es/common/asar.md'
Environment
- Operating system - ?
- Node.js version (
node --version
) - ? - tldr-node-client version (
tldr --version
) - ?