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;
}
String type = uriParts[off + 0];
- String id = uriParts[off + 1];
+ String id = URLDecoder.decode(uriParts[off + 1], "UTF-8");
InputStream in = null;
}
String type = uriParts[off + 0];
- String id = uriParts[off + 1];
+ String id = URLDecoder.decode(uriParts[off + 1], "UTF-8");
if ("source".equals(type)) {
sourceCover(id, login, luid);
package be.nikiroo.fanfix.library;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
class WebLibraryUrls {
static public final String INDEX_URL = "/";
+ "author/{author}";
static private final String COVER_URL_SOURCE = COVER_URL_BASE
+ "source/{source}";
-
+
static public String getViewUrl(String luid, Integer chap, Integer para) {
return VIEWER_URL //
.replace("{luid}", luid) //
static public String getCoverUrlSource(String source) {
return COVER_URL_SOURCE //
- .replace("{source}", source);
+ .replace("{source}", url(source));
}
static public String getCoverUrlAuthor(String author) {
return COVER_URL_AUTHOR //
- .replace("{author}", author);
+ .replace("{author}", url(author));
}
static public String getDeleteUrlStory(String luid) {
static public boolean isDeleteUrl(String url) {
return url != null && url.startsWith(DELETE_URL_BASE);
}
+
+ static private String url(String value) {
+ try {
+ return URLEncoder.encode(value, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // UTF-8 is always supported
+ e.printStackTrace();
+ return value;
+ }
+ }
}