This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git


The following commit(s) were added to refs/heads/dev by this push:
     new 94828f71 fix: 404 page return 200 status code
94828f71 is described below

commit 94828f71d1d4c7b89f5119fc6538d1c990ffa825
Author: sy-records <[email protected]>
AuthorDate: Fri Sep 20 16:36:24 2024 +0800

    fix: 404 page return 200 status code
---
 internal/router/ui.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/internal/router/ui.go b/internal/router/ui.go
index 1d68384e..b959bcd3 100644
--- a/internal/router/ui.go
+++ b/internal/router/ui.go
@@ -120,10 +120,8 @@ func (a *UIRouter) Register(r *gin.Engine, baseURLPath 
string) {
                        } else {
                                c.Header("content-type", 
"image/vnd.microsoft.icon")
                                filePath = UIRootFilePath + urlPath
-
                        }
                case "/manifest.json":
-                       // filePath = UIRootFilePath + urlPath
                        a.siteInfoController.GetManifestJson(c)
                        return
                case "/install":
@@ -154,6 +152,12 @@ func (a *UIRouter) Register(r *gin.Engine, baseURLPath 
string) {
                        c.String(http.StatusOK, 
strings.ReplaceAll(string(file), "/static", cdnPrefix+"/static"))
                        return
                }
+
+               if filePath == UIIndexFilePath {
+                       c.String(http.StatusNotFound, string(file))
+                       return
+               }
+
                c.String(http.StatusOK, string(file))
        })
 }

Reply via email to