mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 05:05:16 +01:00
Fix for worlds with weird names and URLDecode mumbo-jumbo
This commit is contained in:
parent
91b60be572
commit
ca9aa0727f
@ -7,6 +7,7 @@ import java.io.OutputStream;
|
|||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -155,6 +156,7 @@ public class HttpServerConnection extends Thread {
|
|||||||
boolean directoryHandler = key.endsWith("/");
|
boolean directoryHandler = key.endsWith("/");
|
||||||
if (directoryHandler && request.path.startsWith(entry.getKey()) || !directoryHandler && request.path.equals(entry.getKey())) {
|
if (directoryHandler && request.path.startsWith(entry.getKey()) || !directoryHandler && request.path.equals(entry.getKey())) {
|
||||||
relativePath = request.path.substring(entry.getKey().length());
|
relativePath = request.path.substring(entry.getKey().length());
|
||||||
|
relativePath = URLDecoder.decode(relativePath,"utf-8");
|
||||||
handler = entry.getValue();
|
handler = entry.getValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class ClientUpdateHandler implements HttpHandler {
|
|||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern updatePathPattern = Pattern.compile("world/([a-zA-Z0-9_\\-\\.]+)/([0-9]*)");
|
Pattern updatePathPattern = Pattern.compile("world/([^/]+)/([0-9]*)");
|
||||||
private static final HttpStatus WorldNotFound = new HttpStatus(HttpStatus.NotFound.getCode(), "World Not Found");
|
private static final HttpStatus WorldNotFound = new HttpStatus(HttpStatus.NotFound.getCode(), "World Not Found");
|
||||||
@Override
|
@Override
|
||||||
public void handle(String path, HttpRequest request, HttpResponse response) throws Exception {
|
public void handle(String path, HttpRequest request, HttpResponse response) throws Exception {
|
||||||
|
Loading…
Reference in New Issue
Block a user