From 7128756d9f68146c51225fec79a7a9173a805911 Mon Sep 17 00:00:00 2001
From: Douwe Maan <douwe@gitlab.com>
Date: Wed, 2 Dec 2015 14:58:12 +0100
Subject: [PATCH] Extract title from copy/pasted SSH key when it ends in a
 newline

---
 app/views/profiles/keys/new.html.haml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/views/profiles/keys/new.html.haml b/app/views/profiles/keys/new.html.haml
index 2bf207a3221..11166dc6d99 100644
--- a/app/views/profiles/keys/new.html.haml
+++ b/app/views/profiles/keys/new.html.haml
@@ -9,7 +9,7 @@
   $('#key_key').on('focusout', function(){
     var title = $('#key_title'),
         val      = $('#key_key').val(),
-        comment = val.match(/^\S+ \S+ (.+)$/);
+        comment = val.match(/^\S+ \S+ (.+)\n?$/);
 
     if( comment && comment.length > 1 && title.val() == '' ){
       $('#key_title').val( comment[1] );
-- 
2.30.9