From 4c82d728f4194a5a1f866fdc5ee77a553dfa5a92 Mon Sep 17 00:00:00 2001 From: Silvan <27845747+adlerhurst@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:26:10 +0200 Subject: [PATCH] fix(assets-api): Add error handling for missing file paths (#10938) (cherry picked from commit e7b841a874946899514fa81742c1a12ad4ca7f14) --- internal/api/assets/asset.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/api/assets/asset.go b/internal/api/assets/asset.go index 6035086c4a1..cba90104cd2 100644 --- a/internal/api/assets/asset.go +++ b/internal/api/assets/asset.go @@ -213,7 +213,12 @@ func DownloadHandleFunc(s AssetsService, downloader Downloader) func(http.Respon resourceOwner := downloader.ResourceOwner(ctx, ownerPath) path := "" if ownerPath != "" { - path = strings.Split(r.RequestURI, ownerPath+"/")[1] + splitPath := strings.Split(r.RequestURI, ownerPath+"/") + if len(splitPath) < 2 { + s.ErrorHandler()(w, r, fmt.Errorf("invalid request URI format: %v", r.RequestURI), http.StatusNotFound) + return + } + path = splitPath[1] } objectName, err := downloader.ObjectName(ctx, path) if err != nil {