static URI stripTrailingSlash()

in src/main/java/org/apache/sling/maven/bundlesupport/deploy/method/SlingPostDeployMethod.java [86:104]


    static URI stripTrailingSlash(URI targetURL) {
        if (targetURL.getPath().endsWith("/")) {
            String path = targetURL.getPath().substring(0, targetURL.getPath().length() - 1);
            try {
                return new URI(
                        targetURL.getScheme(),
                        targetURL.getUserInfo(),
                        targetURL.getHost(),
                        targetURL.getPort(),
                        path,
                        targetURL.getQuery(),
                        targetURL.getFragment());
            } catch (URISyntaxException e) {
                throw new IllegalStateException("Could not create new URI from existing one", e); // should never happen
            }
        } else {
            return targetURL;
        }
    }