forked from I2P_Developers/i2p.i2p
i2psnark: Fix buttons on torrent details page (JRE 21)
This commit is contained in:
@@ -586,6 +586,17 @@ class BasicServlet extends HttpServlet
|
||||
protected static String addPaths(String base, String path) {
|
||||
if (path == null)
|
||||
return base;
|
||||
if (path.equals("/")) {
|
||||
// Java 17 and below:
|
||||
// (new File("foo", "/")).toString() = "foo/"
|
||||
// (new File("foo/", "/")).toString() = "foo/"
|
||||
// Java 21:
|
||||
// (new File("foo", "/")).toString() = "foo"
|
||||
// (new File("foo/", "/")).toString() = "foo"
|
||||
if (base.endsWith("/"))
|
||||
return base;
|
||||
return base + path;
|
||||
}
|
||||
String rv = (new File(base, path)).toString();
|
||||
if (SystemVersion.isWindows())
|
||||
rv = rv.replace("\\", "/");
|
||||
|
||||
Reference in New Issue
Block a user