提交 be30ca6f 编写于 作者: S stephenconnolly

The path is now part of the URL path element and not a URL parameter, so we...

The path is now part of the URL path element and not a URL parameter, so we need to encode it differently.  There may be a more correct encoder, but this should work for 99% of cases until I can write one to handle svn paths to sventon URL mapped paths (which requires creating a svn repo with crazy path names and then testing with sventon)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@18257 71c3de6d-444a-0410-be80-ed276b4c234a
上级 10cc0441
......@@ -40,6 +40,7 @@ import org.kohsuke.stapler.QueryParameter;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
......@@ -88,7 +89,7 @@ public class Sventon2 extends SubversionRepositoryBrowser {
return null; // no diff if this is not an edit change
int r = path.getLogEntry().getRevision();
return new URL(url, String.format("repos/%s/diff/%s?revision=%d",
repositoryInstance,URLEncoder.encode(getPath(path), URL_CHARSET), r));
repositoryInstance,encodePath(getPath(path)), r));
}
@Override
......@@ -97,7 +98,7 @@ public class Sventon2 extends SubversionRepositoryBrowser {
return null; // no file if it's gone
int r = path.getLogEntry().getRevision();
return new URL(url, String.format("repos/%s/goto/%s?revision=%d",
repositoryInstance,URLEncoder.encode(getPath(path), URL_CHARSET), r));
repositoryInstance,encodePath(getPath(path)), r));
}
/**
......@@ -110,6 +111,16 @@ public class Sventon2 extends SubversionRepositoryBrowser {
return s;
}
private static String encodePath(String path)
throws UnsupportedEncodingException
{
StringBuilder buf = new StringBuilder( );
for (String pathElement: path.split( "/" )) {
buf.append(URLEncoder.encode(pathElement, URL_CHARSET));
}
return buf.toString();
}
@Override
public URL getChangeSetLink(LogEntry changeSet) throws IOException {
return new URL(url, String.format("repos/%s/info?revision=%d",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册