From f8e422bff38c36d939fe8f1f28a2da5eb0979a38 Mon Sep 17 00:00:00 2001 From: liuliaozhong Date: Mon, 15 May 2023 11:03:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20fast=5Ftransfer=5Ffile=20API=20=E5=88=86?= =?UTF-8?q?=E5=8F=91=E6=96=87=E4=BB=B6=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=BA=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E7=A9=BA=E6=A0=BC=EF=BC=8C=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20#812?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../job/common/util/FilePathValidateUtilTest.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/backend/commons/common-utils/src/test/java/com/tencent/bk/job/common/util/FilePathValidateUtilTest.java b/src/backend/commons/common-utils/src/test/java/com/tencent/bk/job/common/util/FilePathValidateUtilTest.java index 327d323d29..45f32c3bb5 100644 --- a/src/backend/commons/common-utils/src/test/java/com/tencent/bk/job/common/util/FilePathValidateUtilTest.java +++ b/src/backend/commons/common-utils/src/test/java/com/tencent/bk/job/common/util/FilePathValidateUtilTest.java @@ -6,8 +6,7 @@ public class FilePathValidateUtilTest { @Test - void testFileSystemAbsolutePath(){ - // 传统DOS路径 + void testWindowsFilePath(){ assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("C:\\Documents\\abc.txt")).isTrue(); assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("c:\\Documents\\abc.txt")).isTrue(); assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("C:\\Documents\\嘉 abc.txt")).isTrue(); @@ -37,9 +36,10 @@ void testFileSystemAbsolutePath(){ assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("${path}\\test.txt")).isTrue(); assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("C:\\tmp\\${path}")).isTrue(); assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("C:\\${date}\\${path}")).isTrue(); + } - // linux路径 - assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/data/test_2022-04-12.apk")).isTrue(); + @Test + void testLinuxFilePath(){ assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/data/test_2022 04 12.apk")).isTrue(); assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/")).isTrue(); assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp/")).isTrue(); @@ -49,11 +49,6 @@ void testFileSystemAbsolutePath(){ assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("///")).isTrue(); // 根目录 assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp////")).isTrue(); // /tmp/ assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp//test/")).isTrue();// /tmp/test/ - assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp/abc>a")).isTrue(); - assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp/abc:a")).isTrue(); - assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp/abc|a")).isTrue(); - assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp/abc?a")).isTrue(); - assertThat(FilePathValidateUtil.validateFileSystemAbsolutePath("/tmp/abc