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

Issue:
bug: `--hyperlink` doesn't work when using patterns/wildcard
- eza v0.18.6 [+git]
- command-line `$ eza --hyperlink *Loop*`
- Arch Linux 6.7.8-zen1-1-zen x86_64

When attempting to use the `--hyperlink` option with a pattern (e.g., *Loop*), the command does not produce hyperlinks for the files that match the pattern. Instead, the files are listed as if I haven't included the hyperlink option at all.

Expected Behavior:

The `--hyperlink` option is expected to create clickable hyperlinks for each file that matches the specified pattern.


Discussion / hints:
Could you show exactly how you got this to happen, to make it easier to reproduce. 
Can do: 
https://youtu.be/dkpsO5kdOhA 
(github won't let me attach the video, it keeps telling me it's corrupted)

So first what I'm doing here is listing out all the files in the folder with hyperlink option, and it works as expected (that's not part of the bug). Then running the same command and looking for a pattern `*Loop*` won't make the results hyperlinked. Regardless of the pattern used, the results are not hyperlinked.
I am new to Rust and to eza, but the problems seems to lie in the path resolution. Files in the current directory, when passed as arguments (be it directly with `eza file1` or with `eza *PATTERN*`) are not recognized as such. This lets this check https://github.com/eza-community/eza/blob/1185e0db11b7d6d6ba628f33e4a1f68c9822475f/src/output/file_name.rs#L388 fail and as a result does not add the markers for hyperlinks.

A workaround is explicitly specifying the current directory, i.e. `eza --hyperlink ./*PATTERN*` should work.

I'll look into this some more and see if I can come up with a patch. (Not sure if just prepending the path with `./` can lead to unexpected consequences.)

**Update**: This is a regression bug, introduced in 4799a492. Need to check https://github.com/eza-community/eza/pull/791 to get a better understanding what the new code is solving.

Fix patch:
diff --git a/src/fs/file.rs b/src/fs/file.rs
index efac1f93f..ca0be62b5 100644
--- a/src/fs/file.rs
+++ b/src/fs/file.rs
@@ -344,7 +344,7 @@ impl<'dir> File<'dir> {
     pub fn absolute_path(&self) -> Option<&PathBuf> {
         self.absolute_path
             .get_or_init(|| {
-                if self.link_target().is_broken() {
+                if self.is_link() && self.link_target().is_broken() {
                     // workaround for broken symlinks to get absolute path for parent and then
                     // append name of file; std::fs::canonicalize requires all path components
                     // (including the last one) to exist


Test patch: