Skip to content
Permalink
Browse files

JENKINS-22342 ensure URL normalization correct

Previous attempts to fix this stored the normalization flag
in the serialized repository browser. Moved to be a function
call to avoid the deserializer getting involved
  • Loading branch information
Alan Clucas
Alan Clucas committed Apr 10, 2014
1 parent 743d715 commit 510337b35a4665f1d938d35215801bd9d354554e
@@ -24,7 +24,6 @@
@DataBoundConstructor
public BitbucketWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -25,7 +25,6 @@
@DataBoundConstructor
public CGit(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -27,7 +27,6 @@
@DataBoundConstructor
public FisheyeGitRepositoryBrowser(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -30,7 +30,6 @@
public GitBlitRepositoryBrowser(String repoUrl, String projectName) {
super(repoUrl);
this.projectName = projectName;
this.normalizeUrl = true;
}

@Override
@@ -27,7 +27,6 @@
public GitLab(String repoUrl, String version) {
super(repoUrl);
this.version = Double.valueOf(version);
this.normalizeUrl = true;
}

public double getVersion() {
@@ -14,11 +14,6 @@
public abstract class GitRepositoryBrowser extends RepositoryBrowser<GitChangeSet> {

private /* mostly final */ String url;
protected boolean normalizeUrl;

@Deprecated
protected GitRepositoryBrowser() {
}

protected GitRepositoryBrowser(String repourl) {
this.url = repourl;
@@ -44,7 +39,7 @@ public final URL getUrl() throws IOException {
}
}

if (normalizeUrl) {
if (getNormalizeUrl()) {
return normalizeToEndWithSlash(new URL(u));
}
else {
@@ -74,5 +69,15 @@ public final URL getUrl() throws IOException {
*/
public abstract URL getFileLink(GitChangeSet.Path path) throws IOException;

/**
* Determines whether a URL should be normalized
* Overridden in the rare case where it shouldn't
*
* @return True if the URL should be normalized
*/
protected boolean getNormalizeUrl() {
return true;
}

private static final long serialVersionUID = 1L;
}
@@ -25,7 +25,11 @@
@DataBoundConstructor
public GitWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = false;
}

@Override
protected boolean getNormalizeUrl() {
return false;
}

@Override
@@ -33,7 +33,6 @@
@DataBoundConstructor
public GithubWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -24,7 +24,6 @@
@DataBoundConstructor
public GitoriousWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -26,7 +26,6 @@
@DataBoundConstructor
public KilnGit(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -27,7 +27,6 @@
public Phabricator(String repoUrl, String repo) {
super(repoUrl);
this.repo = repo;
this.normalizeUrl = true;
}

public String getRepo() {
@@ -26,7 +26,6 @@
@DataBoundConstructor
public RedmineWeb(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

@Override
@@ -42,8 +41,8 @@ public URL getChangeSetLink(GitChangeSet changeSet) throws IOException {
*
* Returns a diff link for {@link EditType#DELETE} and {@link EditType#EDIT}, for {@link EditType#ADD} returns an
* {@link #getFileLink}.
*
*
*
*
* @param path
* affected file path
* @return diff link
@@ -25,7 +25,6 @@
@DataBoundConstructor
public RhodeCode(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -25,7 +25,6 @@
@DataBoundConstructor
public Stash(String repoUrl) {
super(repoUrl);
this.normalizeUrl = true;
}

private QueryBuilder param(URL url) {
@@ -31,7 +31,6 @@
public ViewGitWeb(String repoUrl, String projectName) {
super(repoUrl);
this.projectName = projectName;
this.normalizeUrl = true;
}

@Override

0 comments on commit 510337b

Please sign in to comment.
You can’t perform that action at this time.