git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
878ec53
)
fix url again
author
Niki Roo
<niki@nikiroo.be>
Thu, 28 May 2020 15:15:44 +0000
(17:15 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Thu, 28 May 2020 15:15:44 +0000
(17:15 +0200)
src/be/nikiroo/fanfix/library/WebLibraryServer.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/fanfix/library/WebLibraryServer.java
b/src/be/nikiroo/fanfix/library/WebLibraryServer.java
index 1fce3911eb67f5b47cb95198a9a8c542da9ebf2d..6260f6a5c6744d9c9411d0941ad3ad0a54c5e58b 100644
(file)
--- a/
src/be/nikiroo/fanfix/library/WebLibraryServer.java
+++ b/
src/be/nikiroo/fanfix/library/WebLibraryServer.java
@@
-4,7
+4,6
@@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@
-388,7
+387,11
@@
public class WebLibraryServer extends WebLibraryServerHtml {
protected Response getCover(String uri, WLoginResult login)
throws IOException {
String[] uriParts = uri.split("/");
protected Response getCover(String uri, WLoginResult login)
throws IOException {
String[] uriParts = uri.split("/");
+ int startAt = 0;
int off = 2; // "" and "cover"
int off = 2; // "" and "cover"
+ for (int i = 0; i < off; i++) {
+ startAt += uriParts[i].length() + "/".length();
+ }
if (uriParts.length < off + 2) {
return NanoHTTPD.newFixedLengthResponse(Status.BAD_REQUEST,
if (uriParts.length < off + 2) {
return NanoHTTPD.newFixedLengthResponse(Status.BAD_REQUEST,
@@
-396,7
+399,7
@@
public class WebLibraryServer extends WebLibraryServerHtml {
}
String type = uriParts[off + 0];
}
String type = uriParts[off + 0];
- String id =
URLDecoder.decode(uriParts[off + 1], "UTF-8"
);
+ String id =
uri.substring(startAt + type.length() + "/".length()
);
InputStream in = null;
InputStream in = null;
@@
-430,6
+433,10
@@
public class WebLibraryServer extends WebLibraryServerHtml {
throws IOException {
String[] uriParts = uri.split("/");
int off = 2; // "" and "cover"
throws IOException {
String[] uriParts = uri.split("/");
int off = 2; // "" and "cover"
+ int startAt = 0;
+ for (int i = 0; i < off; i++) {
+ startAt += uriParts[i].length() + "/".length();
+ }
if (uriParts.length < off + 2) {
return NanoHTTPD.newFixedLengthResponse(Status.BAD_REQUEST,
if (uriParts.length < off + 2) {
return NanoHTTPD.newFixedLengthResponse(Status.BAD_REQUEST,
@@
-447,7
+454,7
@@
public class WebLibraryServer extends WebLibraryServerHtml {
}
String type = uriParts[off + 0];
}
String type = uriParts[off + 0];
- String id =
URLDecoder.decode(uriParts[off + 1], "UTF-8"
);
+ String id =
uri.substring(startAt + type.length() + "/".length()
);
if ("source".equals(type)) {
sourceCover(id, login, luid);
if ("source".equals(type)) {
sourceCover(id, login, luid);