Disable previously created public links with the config setting

Этот коммит содержится в:
JoramWilander
2016-03-31 10:08:20 -04:00
родитель c8b2af6246
Коммит c27f700670
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@@ -394,6 +394,11 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
getFileAndForget(path, fileData)
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)) {
c.Err = model.NewLocAppError("getFile", "api.file.get_file.public_invalid.app_error", nil, "")
return