fix(项目设置): 修复文件库文件pull的时候如果文件不存在前台没有报错提示的问题

--bug=1017069 --user=宋天阳 【项目设置】文件管理-PULL文件-git仓库被删除-PULL成功
https://www.tapd.cn/55049933/s/1248383
This commit is contained in:
song-tianyang 2022-09-21 11:01:18 +08:00 committed by 建国
parent 95ba7eff73
commit b87ffcfa40
3 changed files with 17 additions and 17 deletions

View File

@ -302,14 +302,16 @@ public class FileMetadataService {
private void checkName(FileMetadata fileMetadata) {
FileMetadataExample example = new FileMetadataExample();
FileMetadataExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(fileMetadata.getName())
.andProjectIdEqualTo(fileMetadata.getProjectId())
.andIdNotEqualTo(fileMetadata.getId());
if (fileMetadataMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("project_file_already_exists"));
//文件库的名字不用判断是否唯一.是根据文件库路径自动解析生成的
if (!StringUtils.equals(StorageConstants.GIT.name(), fileMetadata.getStorage())) {
FileMetadataExample example = new FileMetadataExample();
FileMetadataExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(fileMetadata.getName())
.andProjectIdEqualTo(fileMetadata.getProjectId())
.andIdNotEqualTo(fileMetadata.getId());
if (fileMetadataMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("project_file_already_exists"));
}
}
}

View File

@ -135,6 +135,7 @@ public class GitRepositoryUtils {
}
} catch (Exception e) {
LogUtil.error("获取文件库文件报错!", e);
MSException.throwException("Connect repository error!");
} finally {
this.closeConnection(repo);
}

View File

@ -41,13 +41,6 @@
<el-main>
<el-form :model="data" :rules="rules" label-position="right" label-width="80px" size="small" ref="form">
<!-- 基础信息 -->
<el-form-item :label="$t('commons.description')" prop="description">
<el-input class="ms-http-textarea"
v-model="data.description"
type="textarea"
:rows="2" size="small" @blur="save"/>
</el-form-item>
<el-form-item :label="$t('load_test.file_name')" prop="name">
<el-input
class="ms-file-item-input"
@ -56,11 +49,15 @@
:disabled="isRepositoryFile()"
show-word-limit @blur="save"/>
</el-form-item>
<el-form-item :label="$t('commons.description')" prop="description">
<el-input class="ms-http-textarea"
v-model="data.description"
type="textarea"
:rows="2" size="small" @blur="save"/>
</el-form-item>
<el-form-item :label="$t('load_test.file_type')" prop="type">
<span>{{ data.type }}</span>
</el-form-item>
<el-form-item :label="$t('load_test.file_size')" prop="size">
<span>{{ formatFileSize(data.size) }}</span>
</el-form-item>