[gnome-builder] new-project: strip whitespace from clipboard before parsing URI



commit bf9c6745b1798c412b51363b59761dbab900e1a4
Author: Christian Hergert <christian hergert me>
Date:   Mon Aug 17 13:48:08 2015 -0700

    new-project: strip whitespace from clipboard before parsing URI
    
    This fixes pasting a URI that contains trailing whitespace after the
    git url. Such can happen when copying URLs from a web browser.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753707

 src/dialogs/gb-new-project-dialog.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/dialogs/gb-new-project-dialog.c b/src/dialogs/gb-new-project-dialog.c
index 8f205a9..7ae4d75 100644
--- a/src/dialogs/gb-new-project-dialog.c
+++ b/src/dialogs/gb-new-project-dialog.c
@@ -354,11 +354,14 @@ gb_new_project_dialog__stack_notify_visible_child (GbNewProjectDialog *self,
     }
   else if (visible_child == GTK_WIDGET (self->page_clone_remote))
     {
-      g_autofree gchar *text= NULL;
+      g_autofree gchar *text = NULL;
       GtkClipboard *clipboard;
 
       clipboard = gtk_widget_get_clipboard (GTK_WIDGET (self), GDK_SELECTION_CLIPBOARD);
       text = gtk_clipboard_wait_for_text (clipboard);
+      if (text != NULL)
+        text = g_strstrip (text);
+
       if (!ide_str_empty0 (text) &&
           (strstr (text, "://") || strchr (text, '@')) &&
           ide_vcs_uri_is_valid (text))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]