From 7b3110f487351fdac35b8433a32ca2f3c00ecc8d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 4 Nov 2015 15:33:16 +0300 Subject: Revert "try to use uid from url" This reverts commit a1224e0db03b6116e4f7f2ed7f8ce265c41ca230. --- src/main/java/com/juick/http/www/Main.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/main/java/com/juick/http/www') diff --git a/src/main/java/com/juick/http/www/Main.java b/src/main/java/com/juick/http/www/Main.java index 4c7f7e14..ced7fb98 100644 --- a/src/main/java/com/juick/http/www/Main.java +++ b/src/main/java/com/juick/http/www/Main.java @@ -228,21 +228,16 @@ public class Main extends HttpServlet implements Stream.StreamListener { closeSqlSearch(); } else if (uri.matches("^/\\d+$")) { String strID = request.getRequestURI().substring(1); - int uid = 0; + int mid = 0; try { - uid = Integer.parseInt(strID); + mid = Integer.parseInt(strID); } catch (NumberFormatException e) { } - if (uid > 0) { - com.juick.User author = UserQueries.getUserByUID(sql, uid); + if (mid > 0) { + com.juick.User author = com.juick.server.MessagesQueries.getMessageAuthor(sql, mid); if (author != null) { - if (author.UName != null) { - Utils.sendPermanentRedirect(response, "/" + author.UName); - return; - } else { - pagesUser.doGetBlog(sql, getSqlSearch(), request, response, author); - return; - } + Utils.sendPermanentRedirect(response, "/" + author.UName + "/" + mid); + return; } } Errors.doGet404(sql, request, response); -- cgit v1.2.3