diff --git a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/model/dto/FileSourceDTO.java b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/model/dto/FileSourceDTO.java index 6b1d2e8f2b..1dd4b1a250 100644 --- a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/model/dto/FileSourceDTO.java +++ b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/model/dto/FileSourceDTO.java @@ -165,7 +165,8 @@ public static EsbFileSourceV3DTO toEsbFileSourceV3DTO(FileSourceDTO fileSourceDT fileSource.setAlias(fileSourceDTO.getAlias()); fileSource.setCredentialId(fileSourceDTO.getCredentialId()); fileSource.setEnable(fileSourceDTO.getEnable()); - fileSource.setFileSourceTypeCode(fileSourceDTO.getFileSourceType().getCode()); + fileSource.setFileSourceTypeCode(fileSourceDTO.getFileSourceType() != null ? + fileSourceDTO.getFileSourceType().getCode() : null); fileSource.setPublicFlag(fileSourceDTO.getPublicFlag()); fileSource.setStatus(fileSourceDTO.getStatus()); fileSource.setCreateTime(fileSourceDTO.getCreateTime()); diff --git a/tests/openapi/src/test/java/com/tencent/bk/job/api/v3/testcase/FileSourceResourceAPITest.java b/tests/openapi/src/test/java/com/tencent/bk/job/api/v3/testcase/FileSourceResourceAPITest.java index c1fb5753ea..7c0beb56ad 100644 --- a/tests/openapi/src/test/java/com/tencent/bk/job/api/v3/testcase/FileSourceResourceAPITest.java +++ b/tests/openapi/src/test/java/com/tencent/bk/job/api/v3/testcase/FileSourceResourceAPITest.java @@ -172,6 +172,7 @@ void testUpdateFileSource() { req.setScopeId(String.valueOf(TestProps.DEFAULT_BIZ)); req.setScopeType(ResourceScopeTypeEnum.BIZ.getValue()); req.setCode(fileSourceSimpleInfoV3DTO.getCode()); + req.setType(FileSourceTypeEnum.BLUEKING_ARTIFACTORY.name()); req.setAlias(TestValueGenerator.generateUniqueStrValue("update_file_source_alias", 50)); given().spec(ApiUtil.requestSpec(TestProps.DEFAULT_TEST_USER)) .body(JsonUtil.toJson(req))