Commit d10af663 authored by Tiago Cunha's avatar Tiago Cunha

Remove more invalid chars

parent 0e6e0dd0
...@@ -16,7 +16,8 @@ public class ServerPolicyHelper { ...@@ -16,7 +16,8 @@ public class ServerPolicyHelper {
return "demo.rocket.chat"; return "demo.rocket.chat";
} }
return removeTrailingSlash(removeProtocol(enforceDefaultHost(hostname))); return removeExtraInvalidChars(
removeTrailingSlash(removeProtocol(enforceDefaultHost(hostname))));
} }
public static Observable<ServerValidation> isApiVersionValid( public static Observable<ServerValidation> isApiVersionValid(
...@@ -50,6 +51,10 @@ public class ServerPolicyHelper { ...@@ -50,6 +51,10 @@ public class ServerPolicyHelper {
return hostname.replaceAll("/+$", ""); return hostname.replaceAll("/+$", "");
} }
private static String removeExtraInvalidChars(String hostname) {
return hostname.replaceAll("[^\\w|\\.|\\-|/]", "");
}
private static boolean isValid(JSONObject jsonObject) { private static boolean isValid(JSONObject jsonObject) {
if (jsonObject == null) { if (jsonObject == null) {
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment