Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure root URL ends with slash #71

Merged
merged 3 commits into from
Dec 20, 2019
Merged

ensure root URL ends with slash #71

merged 3 commits into from
Dec 20, 2019

Conversation

jetersen
Copy link
Member

@jetersen jetersen commented Dec 19, 2019

the getRootUrl() behaves differently, however it ensures that JenkinsLocationConfiguration.get().getUrl() ends with /

    public String getRootUrl() throws IllegalStateException {
        JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
        if (config == null) {
            Jenkins j = getInstance();
            throw new IllegalStateException("Jenkins instance " + j + " has been successfully initialized, but JenkinsLocationConfiguration is undefined.");
        } else {
            String url = config.getUrl();
            if (url != null) {
                return Util.ensureEndsWith(url, "/");
            } else {
                StaplerRequest req = Stapler.getCurrentRequest();
                return req != null ? this.getRootUrlFromRequest() : null;
            }
        }
    }

@jetersen
Copy link
Member Author

@ziouf please take a look :)

@jetersen jetersen changed the title Jenkins getRootUrl ensures that the URL ends with slash ensure root URL ends with slash Dec 20, 2019
@jetersen jetersen merged commit 5968973 into jenkinsci:master Dec 20, 2019
@jetersen jetersen deleted the fix/hook-double-slash branch December 20, 2019 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants