fix(文件管理): 文件上传路径为空时文件依然能上传的问题

--bug=1019951 --user=李玉号 [文件管理]github
#198602.3版本minio挂掉之后,页面看起来还可以上传文件,会误导用户,造成不好的印象
https://www.tapd.cn/55049933/s/1299745

Closes #19860
This commit is contained in:
shiziyuan9527 2022-11-21 16:36:23 +08:00 committed by 刘瑞斌
parent afaf1478b5
commit eae9608e9b
4 changed files with 6 additions and 0 deletions

View File

@ -124,6 +124,9 @@ public class FileMetadataService {
// 上传文件
FileRequest request = new FileRequest(fileMetadata.getProjectId(), fileMetadata.getName(), fileMetadata.getType());
String path = fileManagerService.upload(file, request);
if (StringUtils.isBlank(path)) {
MSException.throwException(Translator.get("upload_file_fail_get_file_path_fail"));
}
fileMetadata.setPath(path);
if (fileMetadataMapper.selectByPrimaryKey(fileMetadata.getId()) == null) {
fileMetadata.setLatest(true);

View File

@ -13,6 +13,7 @@ upload_fail=Upload fail
invalid_parameter=Invalid parameter!
name_already_exists=Name already exists
resource_not_exist=The resource does not exist or has been deleted
upload_file_fail_get_file_path_fail=Failed to upload the file, failed to get the file path
#user related
user_email_already_exists=User email already exists
user_id_is_null=User ID cannot be null

View File

@ -11,6 +11,7 @@ upload_fail=文件上传失败
invalid_parameter=非法的参数
name_already_exists=该名称已经存在
resource_not_exist=资源不存在或已删除
upload_file_fail_get_file_path_fail=文件上傳失敗,獲取文件上傳路徑為空
#user related
user_email_already_exists=用户邮箱已存在
user_id_is_null=用户ID不能为空

View File

@ -11,6 +11,7 @@ upload_fail=文件上傳失敗
invalid_parameter=非法的參數
name_already_exists=該名稱已經存在
resource_not_exist=資源不存在或已刪除
upload_file_fail_get_file_path_fail=文件上傳失敗,獲取文件路徑失敗
#user related
user_email_already_exists=用戶郵箱已存在
user_id_is_null=用戶ID不能為空