Skip to content

Commit

Permalink
fixed JENKINS-18283 : Wrong URL in diff
Browse files Browse the repository at this point in the history
  • Loading branch information
ducquoc committed Jun 14, 2013
1 parent 6f5be78 commit 93e9966
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/hudson/plugins/viewVC/ViewVCRepositoryBrowser.java
Expand Up @@ -63,12 +63,22 @@ public URL getUrl() {

@Override
public URL getDiffLink(Path path) throws IOException {
return new URL(getUrl(), String.format(DIFF_FORMAT, path.getValue(), getLocation(), path.getLogEntry().getRevision() - 1, path.getLogEntry().getRevision()));
String baseUrl = getUrl().toString();
// eliminate trailing slash since the SVN path already has it
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
}
return new URL(baseUrl + String.format(DIFF_FORMAT, path.getValue(), getLocation(), path.getLogEntry().getRevision() - 1, path.getLogEntry().getRevision()));
}

@Override
public URL getFileLink(Path path) throws IOException {
return new URL(getUrl(), String.format(FILE_FORMAT, path.getValue(), getLocation()));
String baseUrl = getUrl().toString();
// eliminate trailing slash since the SVN path already has it
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
}
return new URL(baseUrl + String.format(FILE_FORMAT, path.getValue(), getLocation()));
}

@Override
Expand Down

0 comments on commit 93e9966

Please sign in to comment.