mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #2011 from mattermost/plt-1837
PLT-1837 Remove expiry from public links
This commit is contained in:
@@ -398,13 +398,6 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_invalid.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
props := model.MapFromJson(strings.NewReader(data))
|
||||
|
||||
t, err := strconv.ParseInt(props["time"], 10, 64)
|
||||
if err != nil || model.GetMillis()-t > 1000*60*60*24*7 { // one week
|
||||
c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_expired.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
} else if !c.HasPermissionsToChannel(cchan, "getFile") {
|
||||
return
|
||||
}
|
||||
@@ -484,7 +477,6 @@ func getPublicLink(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
newProps := make(map[string]string)
|
||||
newProps["filename"] = filename
|
||||
newProps["time"] = fmt.Sprintf("%v", model.GetMillis())
|
||||
|
||||
data := model.MapToJson(newProps)
|
||||
hash := model.HashPassword(fmt.Sprintf("%v:%v", data, utils.Cfg.FileSettings.PublicLinkSalt))
|
||||
|
||||
@@ -455,10 +455,6 @@
|
||||
"id": "api.file.get_file.not_found.app_error",
|
||||
"translation": "Could not find file."
|
||||
},
|
||||
{
|
||||
"id": "api.file.get_file.public_expired.app_error",
|
||||
"translation": "The public link has expired"
|
||||
},
|
||||
{
|
||||
"id": "api.file.get_file.public_invalid.app_error",
|
||||
"translation": "The public link does not appear to be valid"
|
||||
@@ -3395,4 +3391,4 @@
|
||||
"id": "web.watcher_fail.error",
|
||||
"translation": "Failed to add directory to watcher %v"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -455,10 +455,6 @@
|
||||
"id": "api.file.get_file.not_found.app_error",
|
||||
"translation": "No se encontró el archivo."
|
||||
},
|
||||
{
|
||||
"id": "api.file.get_file.public_expired.app_error",
|
||||
"translation": "El enlace público ha expirado"
|
||||
},
|
||||
{
|
||||
"id": "api.file.get_file.public_invalid.app_error",
|
||||
"translation": "El enlace público parece ser inválido"
|
||||
@@ -3395,4 +3391,4 @@
|
||||
"id": "web.watcher_fail.error",
|
||||
"translation": "Falla al agregar el directorio a ser vigilado %v"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user