301 instead of 302 to support browser caching

This commit is contained in:
Thomas Zarebczan 2021-06-23 14:39:06 -04:00 committed by GitHub
parent f85ba66de3
commit 2929273531
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,11 +121,11 @@ func view(c *gin.Context) {
resizeParams = fmt.Sprintf("&height=%s&width=%s", height, width) resizeParams = fmt.Sprintf("&height=%s&width=%s", height, width)
} }
if parts := regexp.MustCompile(`^(view/)?([a-f0-9]+)/(.*?)\.(.*)$`).FindStringSubmatch(url); parts != nil { if parts := regexp.MustCompile(`^(view/)?([a-f0-9]+)/(.*?)\.(.*)$`).FindStringSubmatch(url); parts != nil {
c.Redirect(302, fmt.Sprintf("%s%s:%s.%s%s", redirectBaseURL, parts[3], parts[2], parts[4], resizeParams)) c.Redirect(301, fmt.Sprintf("%s%s:%s.%s%s", redirectBaseURL, parts[3], parts[2], parts[4], resizeParams))
return return
} }
c.Redirect(302, redirectBaseURL+url+resizeParams) c.Redirect(301, redirectBaseURL+url+resizeParams)
return return
} }