Repository: eza-community/eza (language: rust)

Issue:
bug: --hyperlink links all raise an "invalid link" error when clicked
- eza --version = 0.12.0
- The command-line arguments you are using: --hyperlink
- Your operating system and hardware platform: Windows 11 Pro + Windows Terminal 1.17.11461.0 on HP ZBook Firefly 15 G8 PC

Hello,
any hyperlink generated leads to this same "the link is not valid" error when clicked - be it a directory or a file of any type:

![image](https://github.com/eza-community/eza/assets/12746830/72927275-f1a8-4a12-b75e-e5949830d98f)



Discussion / hints:

Fix patch:
diff --git a/src/output/file_name.rs b/src/output/file_name.rs
index c72dacd77..c397a4462 100644
--- a/src/output/file_name.rs
+++ b/src/output/file_name.rs
@@ -351,6 +351,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
         let mut display_hyperlink = false;
         if self.options.embed_hyperlinks == EmbedHyperlinks::On {
             if let Some(abs_path) = self.file.absolute_path.as_ref().and_then(|p| p.as_os_str().to_str()) {
+                #[cfg(not(target_os = "windows"))]
                 bits.insert(0, ANSIString::from(format!(
                     "{}file://{}{}{}",
                     HYPERLINK_START,
@@ -358,6 +359,14 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
                     urlencoding::encode(abs_path).replace("%2F", "/"),
                     HYPERLINK_END,
                 )));
+                #[cfg(target_os = "windows")]
+                bits.insert(0, ANSIString::from(format!(
+                    "{}file://{}{}",
+                    HYPERLINK_START,
+                    abs_path.replace("\\\\?\\", ""),
+                    HYPERLINK_END,
+                )));
+
                 display_hyperlink = true;
             }
         }


Test patch: