]> source.dussan.org Git - gitblit.git/commitdiff
Strip line breaks from pasted SSH keys 45/245/1
authorJames Moger <james.moger@gitblit.com>
Sat, 7 Mar 2015 14:25:54 +0000 (09:25 -0500)
committerJames Moger <james.moger@gitblit.com>
Sat, 7 Mar 2015 14:25:54 +0000 (09:25 -0500)
src/main/java/com/gitblit/transport/ssh/SshKey.java

index ab44854a5cf5acf4858bd4f808e9f583fea36272..9c99d1a5fc9bb44140c908ccfdbf4da38c3ea1aa 100644 (file)
@@ -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;
        }