shashwatah / jot

⚡Rapid note management for the terminal.
MIT License
554 stars 8 forks source link

Crashes when using ls if entry extension returns None value in rec_list #12

Closed Zrocket closed 8 months ago

Zrocket commented 11 months ago

When playing around with jot using my existing Obsidian vault this error would occour when trying to list the directory:

Notes
├── Notes
│   ├── Bins
│   │   └── Images
│   │       └── LYT Kit
│   ├── .obsidian
thread 'main' panicked at /home/tamer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jt-0.1.2/src/utils.rs:188:49:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Poking around in the source, I found that this is a result of line 199 in utils.rs:

if entry.is_file() && entry.extension().unwrap() != "md" {

Specifically, this is a result of trying to unwrap a None value if an extension is not found.

If it pleases you, I've created a simple fix that resolves the issue.

Zrocket commented 11 months ago

I created a pull request.

shashwatah commented 8 months ago

I've merged your pull request (#13). Thanks for the contribution!