s3 presigned test

test-v3dev1
withchao 1 year ago
parent 2f1d9f6265
commit e62f5d8d7c

@ -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)

@ -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())

Loading…
Cancel
Save