summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2015-03-07 08:30:58 -0600
committerJames Moger <james.moger@gitblit.com>2015-03-07 08:30:58 -0600
commitc9afc9ed01dbc6b74ecb2734d2cd7ed943b5d643 (patch)
tree51f0e05fd6d8135c4b9b187bd6761f8372f53343
parent77f7a62b2d36fca3ca81e567bfce67217136a992 (diff)
parent8b70d52151e825e3711c2283861a919a14dc3a7b (diff)
downloadgitblit-c9afc9ed01dbc6b74ecb2734d2cd7ed943b5d643.tar.gz
gitblit-c9afc9ed01dbc6b74ecb2734d2cd7ed943b5d643.zip
Merged #245 "Strip line breaks from pasted SSH keys"
-rw-r--r--src/main/java/com/gitblit/transport/ssh/SshKey.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/transport/ssh/SshKey.java b/src/main/java/com/gitblit/transport/ssh/SshKey.java
index ab44854a..9c99d1a5 100644
--- a/src/main/java/com/gitblit/transport/ssh/SshKey.java
+++ b/src/main/java/com/gitblit/transport/ssh/SshKey.java
@@ -27,6 +27,7 @@ import org.eclipse.jgit.lib.Constants;
import com.gitblit.Constants.AccessPermission;
import com.gitblit.utils.StringUtils;
+import com.google.common.base.Joiner;
/**
* Class that encapsulates a public SSH key and it's metadata.
@@ -51,7 +52,8 @@ public class SshKey implements Serializable {
private AccessPermission permission;
public SshKey(String data) {
- this.rawData = data;
+ // strip out line breaks (issue-571)
+ this.rawData = Joiner.on("").join(data.replace("\r\n", "\n").split("\n"));
this.permission = AccessPermission.PUSH;
}