From 8b70d52151e825e3711c2283861a919a14dc3a7b Mon Sep 17 00:00:00 2001 From: James Moger Date: Sat, 7 Mar 2015 09:25:54 -0500 Subject: [PATCH] Strip line breaks from pasted SSH keys --- src/main/java/com/gitblit/transport/ssh/SshKey.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.39.5