diff --git a/internal/api/route.go b/internal/api/route.go index e8324b89e..973bf058f 100644 --- a/internal/api/route.go +++ b/internal/api/route.go @@ -117,7 +117,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive objectGroup.POST("/auth_sign", t.AuthSign) objectGroup.POST("/complete_multipart_upload", t.CompleteMultipartUpload) objectGroup.POST("/access_url", t.AccessURL) - objectGroup.GET("/object/*name", t.ObjectRedirect) + objectGroup.GET("/*name", t.ObjectRedirect) } //Message msgGroup := r.Group("/msg", ParseToken) diff --git a/internal/api/third.go b/internal/api/third.go index 1beac0fe9..ad9475511 100644 --- a/internal/api/third.go +++ b/internal/api/third.go @@ -55,6 +55,13 @@ func (o *ThirdApi) AccessURL(c *gin.Context) { func (o *ThirdApi) ObjectRedirect(c *gin.Context) { name := c.Param("name") + if name == "" { + c.String(http.StatusBadRequest, "name is empty") + return + } + if name[0] == '/' { + name = name[1:] + } operationID := c.Query("operationID") if operationID == "" { operationID = strconv.Itoa(rand.Int())