[pitivi] render: Add blacklist for invalid characters



commit 00627f004dd8c0edf642f35ff76a0b50c9f9e72b
Author: vinayak <vinayak saxena 90 gmail com>
Date:   Tue Jan 15 13:53:26 2019 +0530

    render: Add blacklist for invalid characters
    
    Fixes #1290

 pitivi/render.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/render.py b/pitivi/render.py
index e5bba746..14c5a096 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -701,17 +701,26 @@ class RenderDialog(Loggable):
         if not path:
             # This happens when the window is initialized.
             return
-        warning_icon = "dialog-warning"
+
         filename = self.fileentry.get_text()
+
+        # Characters that cause pipeline failure.
+        blacklist = ["/"]
+        invalid_chars = "".join([ch for ch in blacklist if ch in filename])
+
+        warning_icon = "dialog-warning"
         if not filename:
             tooltip_text = _("A file name is required.")
-        elif filename and os.path.exists(os.path.join(path, filename)):
+        elif os.path.exists(os.path.join(path, filename)):
             tooltip_text = _("This file already exists.\n"
                              "If you don't want to overwrite it, choose a "
                              "different file name or folder.")
+        elif invalid_chars:
+            tooltip_text = _("Remove invalid characters from the filename: %s") % invalid_chars
         else:
             warning_icon = None
             tooltip_text = None
+
         self.fileentry.set_icon_from_icon_name(1, warning_icon)
         self.fileentry.set_icon_tooltip_text(1, tooltip_text)
 


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