summaryrefslogtreecommitdiffstats
path: root/org/madore
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2021-01-05 16:48:35 +0100
committerDavid A. Madore <david+git@madore.org>2021-01-05 16:48:35 +0100
commitb4394756f7564ba9b69d21f66cffcf6d70db9bf5 (patch)
tree80f17cc222b8974321e738337df28aeb0126dd72 /org/madore
parentae3384fd037379fb5083ed1de3e1f45875260b96 (diff)
downloaddamlengine-b4394756f7564ba9b69d21f66cffcf6d70db9bf5.tar.gz
damlengine-b4394756f7564ba9b69d21f66cffcf6d70db9bf5.tar.bz2
damlengine-b4394756f7564ba9b69d21f66cffcf6d70db9bf5.zip
Change how redirects are done (any extra string is allowed, and redirect if it doesn't match as expected).
Diffstat (limited to 'org/madore')
-rw-r--r--org/madore/damlengine/WeblogServlet.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
index 0f7341c..86f231a 100644
--- a/org/madore/damlengine/WeblogServlet.java
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -89,8 +89,10 @@ public class WeblogServlet extends HttpServlet {
String specialName = selRes.getString(3);
if ( id != number )
throw new ServletException("this cannot happen");
- if ( extra != null && ! extra.equals(specialName) )
- return new NoSuchPath();
+ if ( ! ( ( extra == null && specialName == null )
+ || ( extra != null && specialName != null
+ && extra.equals(specialName) ) ) )
+ return new SingleBlogEntryRedirectPath(date, id, specialName);
long lastModified = (long)(mdate*1000);
long thisLastModified;
try {
@@ -108,6 +110,7 @@ public class WeblogServlet extends HttpServlet {
throw new ServletException(e);
}
}
+ // Legacy support for an old permalink format:
if ( inGet && (matcher=Pattern.compile("/d\\.(\\d{4}-\\d{2}-\\d{2})\\.([\\p{Alpha}][\\p{Alnum}\\-]*)\\.html").matcher(pathInfo)).matches() ) {
final String date;
final String extra;
@@ -151,7 +154,7 @@ public class WeblogServlet extends HttpServlet {
static final class SingleBlogEntryRedirectPath extends RequestPath {
public String date;
public int number;
- public String extra;
+ public String extra; // May be null (passed to WeblogLink class)
public SingleBlogEntryRedirectPath(String date, int number, String extra) {
this.date = date;
this.number = number;