From 6fea201cc7f30f59ad84c4c742ed8f49cbeeca59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Fri, 12 Jun 2020 10:43:31 +0200 Subject: [PATCH] Fix loading plugin resources without context path When the context path is set to '/', we get an empty context path. Nonetheless the URL has to start with a '/'. So we have to add it explicitly, here. --- CHANGELOG.md | 1 + .../java/sonia/scm/api/v2/resources/UIPluginDtoMapper.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 223f58ed74..19fd735042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Avoid caching of detected browser language ([#1176](https://github.com/scm-manager/scm-manager/pull/1176)) - Fixes configuration of jetty listener address with system property `jetty.host` ([#1173](https://github.com/scm-manager/scm-manager/pull/1173), [#1174](https://github.com/scm-manager/scm-manager/pull/1174)) +- Fixes loading plugin bundles with context path `/` ([#1182](https://github.com/scm-manager/scm-manager/pull/1182/files), [#1181](https://github.com/scm-manager/scm-manager/issues/1181)) ## [2.0.0] - 2020-06-04 ### Added diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UIPluginDtoMapper.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UIPluginDtoMapper.java index c23194f4fe..19e8c9024e 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UIPluginDtoMapper.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/UIPluginDtoMapper.java @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - + package sonia.scm.api.v2.resources; import com.google.common.base.Strings; @@ -77,7 +77,7 @@ public class UIPluginDtoMapper { private String addContextPath(String resource) { String ctxPath = request.getContextPath(); if (Strings.isNullOrEmpty(ctxPath)) { - return resource; + return "/" + resource; } return HttpUtil.append(ctxPath, resource); }