From: James Moger Date: Sat, 7 Mar 2015 14:25:54 +0000 (-0500) Subject: Strip line breaks from pasted SSH keys X-Git-Tag: v1.7.0~4^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Ftickets%2F45%2F245%2F1;p=gitblit.git Strip line breaks from pasted SSH keys --- 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; }