diff options
author | Luca Milanesio <luca.milanesio@gmail.com> | 2023-11-28 10:29:36 +0000 |
---|---|---|
committer | Luca Milanesio <luca.milanesio@gmail.com> | 2023-11-28 13:20:05 +0000 |
commit | 57f93f4663d6cbae9ba83d1e856c1d1c908966df (patch) | |
tree | 6fab05abb47825f3d91655fbbd03f8020b0a332e | |
parent | 4086edfcf174965df4c722d4fafe32e814794ee7 (diff) |
Revert "Redirect all the legacy change URIs in the backend"
This reverts commit 512e5191973f1d0eb81f307ddd3e3356c9213d1b.
Release-Notes: skip
Change-Id: Ia5884ead01ef74b4a1eaf893dbb2304957c6c93c
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
-rw-r--r-- | java/com/google/gerrit/httpd/raw/StaticModule.java | 8 | ||||
-rw-r--r-- | javatests/com/google/gerrit/httpd/raw/StaticModuleTest.java | 33 |
2 files changed, 3 insertions, 38 deletions
diff --git a/java/com/google/gerrit/httpd/raw/StaticModule.java b/java/com/google/gerrit/httpd/raw/StaticModule.java index 37b4b5977e..587d82ae16 100644 --- a/java/com/google/gerrit/httpd/raw/StaticModule.java +++ b/java/com/google/gerrit/httpd/raw/StaticModule.java @@ -19,7 +19,6 @@ import static com.google.gerrit.httpd.raw.StaticModuleConstants.POLYGERRIT_INDEX import static java.nio.file.Files.exists; import static java.nio.file.Files.isReadable; -import com.google.common.annotations.VisibleForTesting; import com.google.common.cache.Cache; import com.google.common.collect.ImmutableList; import com.google.common.flogger.FluentLogger; @@ -63,7 +62,7 @@ import org.eclipse.jgit.lib.Config; public class StaticModule extends ServletModule { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - public static final String CHANGE_NUMBER_URI_REGEX = "^(?:/c)?/([1-9][0-9]*)/?.*"; + public static final String CHANGE_NUMBER_URI_REGEX = "^(?:/c)?/([1-9][0-9]*)/?$"; private static final Pattern CHANGE_NUMBER_URI_PATTERN = Pattern.compile(CHANGE_NUMBER_URI_REGEX); /** @@ -355,7 +354,7 @@ public class StaticModule extends ServletModule { } @Singleton - protected static class PolyGerritFilter implements Filter { + private static class PolyGerritFilter implements Filter { private final HttpServlet polyGerritIndex; private final PolyGerritUiServlet polygerritUI; @@ -406,8 +405,7 @@ public class StaticModule extends ServletModule { return matchPath(POLYGERRIT_ASSET_PATHS, path); } - @VisibleForTesting - protected static boolean isPolyGerritIndex(String path) { + private static boolean isPolyGerritIndex(String path) { return !isChangeNumberUri(path) && matchPath(POLYGERRIT_INDEX_PATHS, path); } diff --git a/javatests/com/google/gerrit/httpd/raw/StaticModuleTest.java b/javatests/com/google/gerrit/httpd/raw/StaticModuleTest.java deleted file mode 100644 index 28ec30ddad..0000000000 --- a/javatests/com/google/gerrit/httpd/raw/StaticModuleTest.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2023 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.gerrit.httpd.raw; - -import static com.google.common.truth.Truth.assertThat; - -import com.google.common.collect.ImmutableList; -import org.junit.Test; - -public class StaticModuleTest { - - @Test - public void doNotMatchPolyGerritIndex() { - ImmutableList.of( - "/c/123456/anyString", - "/123456/anyString", - "/c/123456/comment/9ab75172_67d798e1", - "/123456/comment/9ab75172_67d798e1") - .forEach(url -> assertThat(StaticModule.PolyGerritFilter.isPolyGerritIndex(url)).isFalse()); - } -} |