[pitivi/1.0] render: Add blacklist for invalid characters



commit 9237d5d27629145dd5e76317fa3b0203903cf9ae
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 ea8237a2..2942f415 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -678,17 +678,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]