From 97a67045408e20e3561cfd3482d3dad818b86fb4 Mon Sep 17 00:00:00 2001 From: "denis.sinelnikov" Date: Thu, 26 Dec 2024 11:55:59 +0100 Subject: [PATCH] CB-5609. Refactor after review --- .../src/io/cloudbeaver/service/fs/impl/WebServiceFS.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/bundles/io.cloudbeaver.service.fs/src/io/cloudbeaver/service/fs/impl/WebServiceFS.java b/server/bundles/io.cloudbeaver.service.fs/src/io/cloudbeaver/service/fs/impl/WebServiceFS.java index 2bc3a09b55..3140be5d98 100644 --- a/server/bundles/io.cloudbeaver.service.fs/src/io/cloudbeaver/service/fs/impl/WebServiceFS.java +++ b/server/bundles/io.cloudbeaver.service.fs/src/io/cloudbeaver/service/fs/impl/WebServiceFS.java @@ -44,7 +44,7 @@ */ public class WebServiceFS implements DBWServiceFS { - public static final String FORBIDDEN_FILENAME_REGEX = "[%#:;№_$]"; + private static final Pattern FORBIDDEN_FILENAME_PATTERN = Pattern.compile("[%#:;№_$]"); @NotNull @Override @@ -282,12 +282,11 @@ public boolean deleteFile( } } - private static void validateFilename(String filename) throws DBWebException { - Pattern pattern = Pattern.compile(FORBIDDEN_FILENAME_REGEX); - Matcher matcher = pattern.matcher(filename); + public void validateFilename(String filename) throws DBWebException { + Matcher matcher = FORBIDDEN_FILENAME_PATTERN.matcher(filename); if (matcher.find()) { - throw new DBWebException("File include forbidden symbols: " + filename); + throw new DBWebException("File includes forbidden symbols: " + filename); } } }