diff options
-rw-r--r-- | org/madore/damlengine/WeblogServlet.java | 9 |
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; |