From b037e175e23810ee63bfa1adeb12516c00d74d1f Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 21 Sep 2022 11:01:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E5=BA=93=E6=96=87=E4=BB=B6?= =?UTF-8?q?pull=E7=9A=84=E6=97=B6=E5=80=99=E5=A6=82=E6=9E=9C=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=89=8D=E5=8F=B0=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=8A=A5=E9=94=99=E6=8F=90=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017069 --user=宋天阳 【项目设置】文件管理-PULL文件-git仓库被删除-PULL成功 https://www.tapd.cn/55049933/s/1248383 --- .../metadata/service/FileMetadataService.java | 18 ++++++++++-------- .../metadata/utils/GitRepositoryUtils.java | 1 + .../menu/file/edit/EditFileMetadata.vue | 15 ++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java b/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java index 38a50c8129..48ab08380a 100644 --- a/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java +++ b/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java @@ -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")); + } } } diff --git a/backend/src/main/java/io/metersphere/metadata/utils/GitRepositoryUtils.java b/backend/src/main/java/io/metersphere/metadata/utils/GitRepositoryUtils.java index 53740670cf..093d38babd 100644 --- a/backend/src/main/java/io/metersphere/metadata/utils/GitRepositoryUtils.java +++ b/backend/src/main/java/io/metersphere/metadata/utils/GitRepositoryUtils.java @@ -135,6 +135,7 @@ public class GitRepositoryUtils { } } catch (Exception e) { LogUtil.error("获取文件库文件报错!", e); + MSException.throwException("Connect repository error!"); } finally { this.closeConnection(repo); } diff --git a/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue b/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue index be0146f4c8..d7100d1ac0 100644 --- a/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue +++ b/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue @@ -41,13 +41,6 @@ - - - - - + + + {{ data.type }} - {{ formatFileSize(data.size) }}