From 2623b6818fc0b4e29a25813a07f9422d9cc6cc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Thu, 29 Jan 2026 00:00:14 +0100 Subject: [PATCH] Refactor prefix trimming in publicFileDownloadHandler for improved clarity --- go_cloud/internal/http/routes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go_cloud/internal/http/routes.go b/go_cloud/internal/http/routes.go index fd35d68..7eb7189 100644 --- a/go_cloud/internal/http/routes.go +++ b/go_cloud/internal/http/routes.go @@ -3255,8 +3255,8 @@ func publicFileDownloadHandler(w http.ResponseWriter, r *http.Request, db *datab // Create zip entry - use relative path within the folder relativePath := strings.TrimPrefix(fileToZip.Path, file.Path) - if strings.HasPrefix(relativePath, "/") { - relativePath = strings.TrimPrefix(relativePath, "/") + if after, ok := strings.CutPrefix(relativePath, "/"); ok { + relativePath = after } zipFile, err := zipWriter.Create(relativePath)