summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/utils/StringUtils.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-11-20 20:52:11 -0500
committerJames Moger <james.moger@gitblit.com>2013-11-29 11:05:51 -0500
commit8f1c9fd7e0f7ea3d7d0b87788eb92ba2f0f09d59 (patch)
tree139c932cf95723dc0ee2e8341c6965d2af817e75 /src/main/java/com/gitblit/utils/StringUtils.java
parentbdfdc9c65c5eb2786b7dd8e33ba8a12a3bafe86d (diff)
downloadgitblit-8f1c9fd7e0f7ea3d7d0b87788eb92ba2f0f09d59.tar.gz
gitblit-8f1c9fd7e0f7ea3d7d0b87788eb92ba2f0f09d59.zip
Extract UserManager from GitBlit singleton
Change-Id: I4885255ed63aa6c4e000c3e5501675440dca3958
Diffstat (limited to 'src/main/java/com/gitblit/utils/StringUtils.java')
-rw-r--r--src/main/java/com/gitblit/utils/StringUtils.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/utils/StringUtils.java b/src/main/java/com/gitblit/utils/StringUtils.java
index e18bdc4f..ed10eb6c 100644
--- a/src/main/java/com/gitblit/utils/StringUtils.java
+++ b/src/main/java/com/gitblit/utils/StringUtils.java
@@ -747,4 +747,25 @@ public class StringUtils {
}
return input.replace('\n',' ').replace('\r', ' ').trim();
}
+
+
+ /**
+ * Encode the username for user in an url.
+ *
+ * @param name
+ * @return the encoded name
+ */
+ public static String encodeUsername(String name) {
+ return name.replace("@", "%40").replace(" ", "%20").replace("\\", "%5C");
+ }
+
+ /**
+ * Decode a username from an encoded url.
+ *
+ * @param name
+ * @return the decoded name
+ */
+ public static String decodeUsername(String name) {
+ return name.replace("%40", "@").replace("%20", " ").replace("%5C", "\\");
+ }
} \ No newline at end of file