From 1f4deb0c4f2e5f1790a86f78aaed8a5c0ffeb579 Mon Sep 17 00:00:00 2001 From: HynoR <20227709+HynoR@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:44:52 +0800 Subject: [PATCH 1/2] fix: enhance app icon download logic to include file existence check - Updated the downloadAppIcon function to parse the icon field for the file name and ETag. - Added a condition to check if the icon file exists before setting the If-None-Match header for the request. --- agent/app/service/app_sync_task.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/app/service/app_sync_task.go b/agent/app/service/app_sync_task.go index 7c547e957429..fc9cd950f93d 100644 --- a/agent/app/service/app_sync_task.go +++ b/agent/app/service/app_sync_task.go @@ -215,10 +215,10 @@ func (c *appSyncContext) syncAppIconsAndDetails() error { } func (c *appSyncContext) downloadAppIcon(iconUrl, appKey, oldIcon string) (status int, iconField string) { - existingEtag := appicon.GetETagFromIconField(oldIcon) + iconFileName, existingEtag := appicon.ParseIconField(oldIcon) reqHeaders := make(map[string]string) - if existingEtag != "" { + if existingEtag != "" && iconFileName != "" && appicon.IconFileExists(iconFileName) { reqHeaders["If-None-Match"] = existingEtag } From 4970b3c66f77da40da597c1771953cd3997ffac5 Mon Sep 17 00:00:00 2001 From: HynoR <20227709+HynoR@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:48:27 +0800 Subject: [PATCH 2/2] fix: improve app icon retrieval logic by adding filename check - Updated GetAppIcon method to include filename in the response. - Added a condition to ensure the ETag header is set only if both ETag and filename are present, enhancing the integrity of the caching mechanism. --- agent/app/api/v2/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/app/api/v2/app.go b/agent/app/api/v2/app.go index 6b48e7d5af83..ed6799d98234 100644 --- a/agent/app/api/v2/app.go +++ b/agent/app/api/v2/app.go @@ -210,7 +210,7 @@ func (b *BaseApi) GetAppIcon(c *gin.Context) { helper.BadRequest(c, err) return } - iconBytes, _, etag, err := appService.GetAppIcon(appKey) + iconBytes, filename, etag, err := appService.GetAppIcon(appKey) if err != nil { helper.InternalServer(c, err) return @@ -223,7 +223,7 @@ func (b *BaseApi) GetAppIcon(c *gin.Context) { c.Header("Cache-Control", "public, max-age=2592000") - if etag != "" { + if etag != "" && filename != "" { c.Header("ETag", etag) if c.GetHeader("If-None-Match") == etag { c.Status(http.StatusNotModified)