aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-03 09:11:57 +0300
committerGravatar Vitaly Takmazov2018-10-03 09:35:00 +0300
commit20dbb085fd349424717db1283c248a393bdf1021 (patch)
treeb3d91bacd7b68ea92973279ca0ea17fa6d1ac1e5 /juick-server/src/main/java/com
parentbac87790c6d044e3bfe9781dd285dfa4b33e49ee (diff)
Sphinxsearch: escape =
Diffstat (limited to 'juick-server/src/main/java/com')
-rw-r--r--juick-server/src/main/java/com/juick/server/Utils.java17
-rw-r--r--juick-server/src/main/java/com/juick/server/www/Utils.java45
-rw-r--r--juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java2
-rw-r--r--juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java2
4 files changed, 18 insertions, 48 deletions
diff --git a/juick-server/src/main/java/com/juick/server/Utils.java b/juick-server/src/main/java/com/juick/server/Utils.java
index 4b864fec..23768ed2 100644
--- a/juick-server/src/main/java/com/juick/server/Utils.java
+++ b/juick-server/src/main/java/com/juick/server/Utils.java
@@ -16,6 +16,9 @@
*/
package com.juick.server;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
/**
*
* @author Ugnich Anton
@@ -25,6 +28,18 @@ public class Utils {
public static String encodeSphinx(String str) {
return str.replaceAll("@", "\\\\@")
- .replaceAll("\\'", "\\\\'");
+ .replaceAll("\\'", "\\\\'")
+ .replaceAll("=", "\\\\\\\\=");
+ }
+ /**
+ * Returns the viewName to return for coming back to the sender url
+ *
+ * @param request Instance of {@link HttpServletRequest} or use an injected instance
+ * @return Optional with the view name. Recomended to use an alternativa url with
+ * {@link Optional#orElse(java.lang.Object)}
+ */
+ public static Optional<String> getPreviousPageByRequest(HttpServletRequest request)
+ {
+ return Optional.ofNullable(request.getHeader("Referer"));
}
}
diff --git a/juick-server/src/main/java/com/juick/server/www/Utils.java b/juick-server/src/main/java/com/juick/server/www/Utils.java
deleted file mode 100644
index e53c142b..00000000
--- a/juick-server/src/main/java/com/juick/server/www/Utils.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.juick.server.www;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Optional;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Utils {
-
-
- public static String encodeSphinx(String str) {
- return str.replaceAll("@", "\\\\@")
- .replaceAll("\\'", "\\\\'");
- }
-
- /**
- * Returns the viewName to return for coming back to the sender url
- *
- * @param request Instance of {@link HttpServletRequest} or use an injected instance
- * @return Optional with the view name. Recomended to use an alternativa url with
- * {@link Optional#orElse(java.lang.Object)}
- */
- public static Optional<String> getPreviousPageByRequest(HttpServletRequest request)
- {
- return Optional.ofNullable(request.getHeader("Referer"));
- }
-}
diff --git a/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
index 47c52cb9..3f13b6bb 100644
--- a/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
+++ b/juick-server/src/main/java/com/juick/server/www/controllers/MessagesWWW.java
@@ -19,13 +19,13 @@ package com.juick.server.www.controllers;
import com.juick.Message;
import com.juick.Tag;
import com.juick.formatters.PlainTextFormatter;
+import com.juick.server.Utils;
import com.juick.server.util.HttpForbiddenException;
import com.juick.server.util.HttpNotFoundException;
import com.juick.server.util.UserUtils;
import com.juick.server.util.WebUtils;
import com.juick.service.*;
import com.juick.util.MessageUtils;
-import com.juick.server.www.Utils;
import org.apache.commons.codec.CharEncoding;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
diff --git a/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java b/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java
index 3cea3e34..c6fac269 100644
--- a/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java
+++ b/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java
@@ -25,13 +25,13 @@ import com.github.scribejava.core.model.*;
import com.github.scribejava.core.oauth.OAuth10aService;
import com.github.scribejava.core.oauth.OAuth20Service;
import com.juick.model.facebook.User;
+import com.juick.server.Utils;
import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.UserUtils;
import com.juick.service.CrosspostService;
import com.juick.service.EmailService;
import com.juick.service.TelegramService;
import com.juick.service.UserService;
-import com.juick.server.www.Utils;
import com.juick.model.vk.UsersResponse;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.HmacAlgorithms;