From 52c34c2f1cbe05d20e5471ddfda4235f07080ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20R=C3=B8mer=20Hesselbjerg?= Date: Thu, 9 Jul 2026 09:21:40 +0200 Subject: [PATCH] appview/pages: filetree symlinks render with correct icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jens Rømer Hesselbjerg --- appview/pages/templates/repo/index.html | 2 +- appview/pages/templates/repo/tree.html | 2 +- types/tree.go | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/appview/pages/templates/repo/index.html b/appview/pages/templates/repo/index.html index c4988b28..d60707dc 100644 --- a/appview/pages/templates/repo/index.html +++ b/appview/pages/templates/repo/index.html @@ -151,7 +151,7 @@ {{ if .IsFile }} {{ $link = printf "/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) .Name }} - {{ $icon = "file" }} + {{ $icon = cond .IsSymlink "file-symlink" "file" }} {{ $iconStyle = "size-4" }} {{ end }} diff --git a/appview/pages/templates/repo/tree.html b/appview/pages/templates/repo/tree.html index 96f22f22..fe6604ce 100644 --- a/appview/pages/templates/repo/tree.html +++ b/appview/pages/templates/repo/tree.html @@ -77,7 +77,7 @@ {{ if .IsFile }} {{ $link = printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) $.Path .Name }} - {{ $icon = "file" }} + {{ $icon = cond .IsSymlink "file-symlink" "file" }} {{ $iconStyle = "size-4" }} {{ end }} diff --git a/types/tree.go b/types/tree.go index 830a9a28..17161705 100644 --- a/types/tree.go +++ b/types/tree.go @@ -101,6 +101,16 @@ func (t *NiceTree) IsSubmodule() bool { return m == filemode.Submodule } +func (t *NiceTree) IsSymlink() bool { + m, err := t.FileMode() + + if err != nil { + return false + } + + return m == filemode.Symlink +} + type LastCommitInfo struct { Hash plumbing.Hash Message string -- 2.51.2