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 (parent:
14d8be1
)
e621: allows /post/search/
author
Niki Roo
<niki@nikiroo.be>
Tue, 14 Aug 2018 14:08:48 +0000
(16:08 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Tue, 14 Aug 2018 14:08:48 +0000
(16:08 +0200)
src/be/nikiroo/fanfix/supported/E621.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/fanfix/supported/E621.java
b/src/be/nikiroo/fanfix/supported/E621.java
index aa9c8af1ee26690cdd86429a911d2b1b7a2d9fa3..36b9dad3c9bf3520053e938539a9db149e134695 100644
(file)
--- a/
src/be/nikiroo/fanfix/supported/E621.java
+++ b/
src/be/nikiroo/fanfix/supported/E621.java
@@
-377,19
+377,28
@@
class E621 extends BasicSupport_Deprecated {
protected URL getCanonicalUrl(URL source) {
if (isSearch(source)) {
// /post?tags=tag1+tag2 -> ../post/index/1/tag1%32tag2
protected URL getCanonicalUrl(URL source) {
if (isSearch(source)) {
// /post?tags=tag1+tag2 -> ../post/index/1/tag1%32tag2
- String key = "
post
?tags=";
+ String key = "?tags=";
if (source.toString().contains(key)) {
int pos = source.toString().indexOf(key);
String tags = source.toString().substring(pos + key.length());
tags = tags.replace("+", "%20");
if (source.toString().contains(key)) {
int pos = source.toString().indexOf(key);
String tags = source.toString().substring(pos + key.length());
tags = tags.replace("+", "%20");
+
+ String base = source.toString().substring(0, pos);
+ if (!base.endsWith("/")) {
+ base += "/";
+ }
+ if (base.endsWith("/search/")) {
+ base = base.substring(0, base.indexOf("/search/") + 1);
+ }
+
try {
try {
- return new URL(source.toString().substring(0, pos)
- + "post/index/1/" + tags);
+ return new URL(base + "index/1/" + tags);
} catch (MalformedURLException e) {
Instance.getTraceHandler().error(e);
}
}
}
} catch (MalformedURLException e) {
Instance.getTraceHandler().error(e);
}
}
}
+
return super.getCanonicalUrl(source);
}
return super.getCanonicalUrl(source);
}