From 3cd2fa718e7f0c96988374e0843372d3e48b4659 Mon Sep 17 00:00:00 2001 From: davsad Date: Fri, 29 Jan 2021 13:35:59 +0000 Subject: Fix onboarding artifact name changed Prevent Yang module filenames with prefix _3gpp losing leading _ Issue-ID: SDC-3415 Signed-off-by: davsad Change-Id: I68afb6c8a1ef2fa58a37af20a2119d3b648ba272 --- .../src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common-app-api/src/main') diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java index dfecf927d8..fbc5e9de95 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java @@ -83,6 +83,7 @@ public class ValidationUtils { public static final Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/\\*:|\"/]+"); + public static final Pattern YANG_MODULE_3GPP_PATTERN = Pattern.compile("^(_3gpp).*$"); public static final Pattern DASH_PATTERN = Pattern.compile("[-]+"); public static final Pattern UNDERSCORE_PATTERN = Pattern.compile("[_]+"); public static final Pattern PLUS_PATTERN = Pattern.compile("[+]+"); @@ -465,7 +466,8 @@ public class ValidationUtils { str = normaliseWhitespace(str); str = SPACE_PATTERN.matcher(str).replaceAll("-"); str = DASH_PATTERN.matcher(str).replaceAll("-"); - str = StringUtils.strip(str, "-_ ."); + if (!YANG_MODULE_3GPP_PATTERN.matcher(str).matches()) + str = StringUtils.strip(str, "-_ ."); return str; } -- cgit 1.2.3-korg