From d2ee49dbd596b74b18b5cbb5c8617491e4c9e3e8 Mon Sep 17 00:00:00 2001 From: equationzhao Date: Fri, 31 May 2024 23:46:39 +0800 Subject: [PATCH] empty attribute --- internal/content/extended.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/content/extended.go b/internal/content/extended.go index 2db8b37..f57fad6 100644 --- a/internal/content/extended.go +++ b/internal/content/extended.go @@ -3,12 +3,11 @@ package content import ( "encoding/xml" "fmt" - "github.com/valyala/bytebufferpool" - "github.com/Equationzhao/g/internal/global" "github.com/Equationzhao/g/internal/item" "github.com/Equationzhao/g/internal/render" "github.com/pkg/xattr" + "github.com/valyala/bytebufferpool" "howett.net/plist" ) @@ -32,6 +31,10 @@ func formatBytes(bytes []byte) string { // formatXattrValue attempts to parse the xattr value and returns a human-readable string. func formatXattrValue(value []byte) string { + if len(value) == 0 { + return "" + } + // Check if the value is a binary plist var plistData any if _, err := plist.Unmarshal(value, &plistData); err == nil {