X-Git-Url: https://git.pterodactylus.net/?p=WoTNS.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fwotns%2Fui%2Fweb%2FResolverPage.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fwotns%2Fui%2Fweb%2FResolverPage.java;h=d26d1aa86915bc26b0cafc5e137ede4dc62027cb;hp=6db3b6acf3d7902c7a928e608adf7b28452e5aeb;hb=9288c73f25d0ce121b574812d71b9d4c41d529ba;hpb=d3a937482d13af63940550bb804cd3b47156a426 diff --git a/src/main/java/net/pterodactylus/wotns/ui/web/ResolverPage.java b/src/main/java/net/pterodactylus/wotns/ui/web/ResolverPage.java index 6db3b6a..d26d1aa 100644 --- a/src/main/java/net/pterodactylus/wotns/ui/web/ResolverPage.java +++ b/src/main/java/net/pterodactylus/wotns/ui/web/ResolverPage.java @@ -62,11 +62,19 @@ public class ResolverPage extends BasicPage { protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { String uri = request.getUri().getPath(); String path = uri.substring(uri.indexOf('/', 1) + 1); - FreenetURI targetUri; + + /* look for path after target. */ + int firstSlash = path.indexOf('/'); + int secondSlash = path.indexOf('/', firstSlash + 1); + String filePath = ""; + if (secondSlash != -1) { + filePath = path.substring(secondSlash); + path = path.substring(0, secondSlash); + } try { - targetUri = resolver.resolveURI(path); + FreenetURI targetUri = resolver.resolveURI(path); if (targetUri != null) { - throw new RedirectException("/" + targetUri.toString()); + throw new RedirectException("/" + targetUri.toString() + filePath); } } catch (MalformedURLException mue1) { /* TODO - do something. */