[gnome-builder] libide: bail if not a javascript file



commit a3c46faf3992c6aed7c785248a5e29b26dd0d55c
Author: Christian Hergert <christian hergert me>
Date:   Mon Feb 16 12:31:48 2015 -0800

    libide: bail if not a javascript file

 libide/gjs/ide-gjs-script.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/libide/gjs/ide-gjs-script.cpp b/libide/gjs/ide-gjs-script.cpp
index e5f18f6..5860b62 100644
--- a/libide/gjs/ide-gjs-script.cpp
+++ b/libide/gjs/ide-gjs-script.cpp
@@ -205,6 +205,15 @@ ide_gjs_script_init_async (GAsyncInitable      *initable,
       return;
     }
 
+  if (!g_str_has_suffix (path, ".js"))
+    {
+      g_task_return_new_error (task,
+                               G_IO_ERROR,
+                               G_IO_ERROR_NOT_SUPPORTED,
+                               _("The script is not a javascript file."));
+      return;
+    }
+
   ide_script_load (IDE_SCRIPT (self));
 
   g_task_return_boolean (task, TRUE);


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