summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/GitBlit.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/gitblit/GitBlit.java')
-rw-r--r--src/main/java/com/gitblit/GitBlit.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java
index 3aaa8c6d..c6e24d77 100644
--- a/src/main/java/com/gitblit/GitBlit.java
+++ b/src/main/java/com/gitblit/GitBlit.java
@@ -967,12 +967,24 @@ public class GitBlit implements ServletContextListener {
userService.logout(user);
}
+ /**
+ * Encode the username for user in an url.
+ *
+ * @param name
+ * @return the encoded name
+ */
protected String encodeUsername(String name) {
- return name.replace("@", "%40");
+ return name.replace("@", "%40").replace(" ", "%20").replace("\\", "%5C");
}
+ /**
+ * Decode a username from an encoded url.
+ *
+ * @param name
+ * @return the decoded name
+ */
protected String decodeUsername(String name) {
- return name.replace("%40", "@");
+ return name.replace("%40", "@").replace("%20", " ").replace("%5C", "\\");
}
/**