summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/GitBlit.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-06-20 17:29:05 -0400
committerJames Moger <james.moger@gitblit.com>2013-06-20 17:29:05 -0400
commitbe2d71efb0f369ed05d87b556ac543435d30f6bf (patch)
treeab3e236ba51c2cc9025dfd6d7caefcb6c090b2f2 /src/main/java/com/gitblit/GitBlit.java
parent8198d218935f649ada4f1e9dbc2e7bfe377a1388 (diff)
downloadgitblit-be2d71efb0f369ed05d87b556ac543435d30f6bf.tar.gz
gitblit-be2d71efb0f369ed05d87b556ac543435d30f6bf.zip
Improve username (en|de)coding for urls
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", "\\");
}
/**