From f0318ae01fb83283d3203a753b2fba55263cc309 Mon Sep 17 00:00:00 2001 From: Jeffry Hesse Date: Thu, 13 Dec 2018 16:04:54 -0900 Subject: [PATCH] Remove leading slash --- .../puppet/internal/util/PuppetPathUtils.java | 10 +++++----- .../puppet/internal/util/PuppetPathUtilsTest.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtils.java b/src/main/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtils.java index aead686..b914154 100644 --- a/src/main/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtils.java +++ b/src/main/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtils.java @@ -55,21 +55,21 @@ private String match(final TokenMatcher.State state, final String name) { } public String buildModuleReleaseByNameAndVersionPath(final State matcherState) { - return String.format("/v3/releases/%s-%s-%s", user(matcherState), module(matcherState), version(matcherState)); + return String.format("v3/releases/%s-%s-%s", user(matcherState), module(matcherState), version(matcherState)); } public String buildModuleByNamePath(final State matcherState) { - return String.format("/v3/modules/%s-%s", user(matcherState), module(matcherState)); + return String.format("v3/modules/%s-%s", user(matcherState), module(matcherState)); } public String buildModuleReleaseByNamePath(final Parameters parameters) { if (parameters.isEmpty()) { - return "/v3/releases"; + return "v3/releases"; } - return String.format("/v3/releases?%s", Joiner.on("&").withKeyValueSeparator("=").join(parameters)); + return String.format("v3/releases?%s", Joiner.on("&").withKeyValueSeparator("=").join(parameters)); } public String buildModuleDownloadPath(final State matcherState) { - return String.format("/v3/files/%s-%s-%s.tar.gz", user(matcherState), module(matcherState), version(matcherState)); + return String.format("v3/files/%s-%s-%s.tar.gz", user(matcherState), module(matcherState), version(matcherState)); } } diff --git a/src/test/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtilsTest.java b/src/test/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtilsTest.java index 30ebc3a..f48b188 100644 --- a/src/test/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtilsTest.java +++ b/src/test/java/org/sonatype/nexus/repository/puppet/internal/util/PuppetPathUtilsTest.java @@ -65,7 +65,7 @@ public void buildModuleReleaseByNameAndVersionPath() throws Exception { setupTokens(); String result = underTest.buildModuleReleaseByNameAndVersionPath(mockState); - assertThat(result, is(equalTo("/v3/releases/puppetlabs-stdlib-5.1.0"))); + assertThat(result, is(equalTo("v3/releases/puppetlabs-stdlib-5.1.0"))); } @Test @@ -78,7 +78,7 @@ public void buildModuleReleaseByNamePath() throws Exception { String result = underTest.buildModuleReleaseByNamePath(parameters); - assertThat(result, is(equalTo("/v3/releases?module=puppetlabs-stdlib&sort_by=version"))); + assertThat(result, is(equalTo("v3/releases?module=puppetlabs-stdlib&sort_by=version"))); } @Test @@ -88,7 +88,7 @@ public void buildModuleReleaseByNamePathNoParameters() throws Exception { String result = underTest.buildModuleReleaseByNamePath(parameters); - assertThat(result, is(equalTo("/v3/releases"))); + assertThat(result, is(equalTo("v3/releases"))); } @Test @@ -97,7 +97,7 @@ public void buildModuleByNamePath() throws Exception { String result = underTest.buildModuleByNamePath(mockState); - assertThat(result, is(equalTo("/v3/modules/puppetlabs-stdlib"))); + assertThat(result, is(equalTo("v3/modules/puppetlabs-stdlib"))); } @Test @@ -106,7 +106,7 @@ public void buildModuleDownloadPath() throws Exception { String result = underTest.buildModuleDownloadPath(mockState); - assertThat(result, is(equalTo("/v3/files/puppetlabs-stdlib-5.1.0.tar.gz"))); + assertThat(result, is(equalTo("v3/files/puppetlabs-stdlib-5.1.0.tar.gz"))); } private void setupTokens() {