Inlyne-Project/inlyne

Panic when clicking a link to a bare path with no extension

Opened this issue · 1 comments

Clicking a file link like

[COPYING](COPYING)

will cause inlyne to panic

Relevant crash report
name = "inlyne"
operating_system = "Arch Linux Rolling Release [64-bit]"
crate_version = "0.4.1"
explanation = """
Panic occurred in file 'src/main.rs' at line 510
"""
cause = 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "Launcher \"xdg-open\" \"COPYING\" failed with ExitStatus(unix_wait_status(512))" }'
method = "Panic"
backtrace = """

   0: 0x5a3ce6190233 - core::result::unwrap_failed::hbe14f498be1452f9
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/core/src/result.rs:1649
   1: 0x5a3ce50e5bfa - core::result::Result<T,E>::unwrap::h922cb22929eeca2e
   2: 0x5a3ce50fa0cc - inlyne::Inlyne::run::{{closure}}::h80271196e54d9c54
   3: 0x5a3ce51c7027 - winit::platform_impl::platform::x11::event_processor::EventProcessor<T>::process_event::h4a6a19c2e7d3954b
   4: 0x5a3ce50f0f7c - winit::platform_impl::platform::x11::EventLoop<T>::run_return::single_iteration::h1e113a7ca508eae7
   5: 0x5a3ce50f1822 - winit::platform_impl::platform::x11::EventLoop<T>::run::hd8e39bc30073cae8
   6: 0x5a3ce50f0c9d - winit::platform_impl::platform::EventLoop<T>::run::h836aee4ae61e309d
   7: 0x5a3ce51cf8ba - inlyne::main::h86b81f17a9046268
   8: 0x5a3ce513f463 - std::sys_common::backtrace::__rust_begin_short_backtrace::he2491fbbb75172c0
   9: 0x5a3ce51d05cd - std::rt::lang_start::{{closure}}::h16a99ea5f6ccd83b
  10: 0x5a3ce6151561 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h4eb4c5e1620f29b0
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/core/src/ops/function.rs:284
                 - std::panicking::try::do_call::h73fd26535faffcdf
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/panicking.rs:552
                 - std::panicking::try::h77ff1d98f0fb9f39
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/panicking.rs:516
                 - std::panic::catch_unwind::hab3caf2448b95e37
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/panic.rs:142
                 - std::rt::lang_start_internal::{{closure}}::h8086711f9c783f78
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/rt.rs:148
                 - std::panicking::try::do_call::hf920d4dc291cd6ca
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/panicking.rs:552
                 - std::panicking::try::h2b806ccc0a85db74
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/panicking.rs:516
                 - std::panic::catch_unwind::h038489539c507df2
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/panic.rs:142
                 - std::rt::lang_start_internal::h28503b88912e8a5c
                at /rustc/0e09125c6c3c2fd70d7de961bcf0e51575235fad/library/std/src/rt.rs:148
  11: 0x5a3ce51d01b5 - main
  12: 0x7f86342f0cd0 - <unresolved>
  13: 0x7f86342f0d8a - __libc_start_main
  14: 0x5a3ce507c6a5 - _start
  15:        0x0 - <unresolved>"""

We really should separate out the logic for determining how to handle links and test the hell out of it. It's been a consistent source of issues in the past

Also regardless of the error, we of course should not panic when something like this fails. Another one I just saw was a crash from a link to a directory which I don't know how we should load (on github it opens a page for the directory of course) (it was nix-software-center's data/icons link)