Merge pull request #2590 from mattermost/plt-2287
PLT-2287 Disable previously created public links with the config setting
Этот коммит содержится в:
@@ -394,6 +394,11 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
getFileAndForget(path, fileData)
|
getFileAndForget(path, fileData)
|
||||||
|
|
||||||
if len(hash) > 0 && len(data) > 0 && len(teamId) == 26 {
|
if len(hash) > 0 && len(data) > 0 && len(teamId) == 26 {
|
||||||
|
if !utils.Cfg.FileSettings.EnablePublicLink {
|
||||||
|
c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_disabled.app_error", nil, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.FileSettings.PublicLinkSalt)) {
|
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", data, utils.Cfg.FileSettings.PublicLinkSalt)) {
|
||||||
c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_invalid.app_error", nil, "")
|
c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_invalid.app_error", nil, "")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -475,6 +475,10 @@
|
|||||||
"id": "api.file.get_file.not_found.app_error",
|
"id": "api.file.get_file.not_found.app_error",
|
||||||
"translation": "Could not find file."
|
"translation": "Could not find file."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "api.file.get_file.public_disabled.app_error",
|
||||||
|
"translation": "Public links have been disabled by the system administrator"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "api.file.get_file.public_invalid.app_error",
|
"id": "api.file.get_file.public_invalid.app_error",
|
||||||
"translation": "The public link does not appear to be valid"
|
"translation": "The public link does not appear to be valid"
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user