From 167693551ea3f1bf5a1527d06fe0de4b349f12ec Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Tue, 29 Jul 2014 21:31:30 +0200
Subject: [PATCH] Use commands.mkarg to properly quote file names.

---
 slidegtk.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/slidegtk.py b/slidegtk.py
index 07ba241..b3c49b9 100755
--- a/slidegtk.py
+++ b/slidegtk.py
@@ -5,6 +5,7 @@ import os
 import sys
 import time
 import getopt
+import commands
 
 import pygtk
 pygtk.require('2.0')
@@ -30,7 +31,8 @@ class ImageCache(object):
 
     def processed_file(self, infile, rotation = 0):
         if rotation == 0:
-            fp = os.popen("identify -format \"%w %h\" " + infile)
+            fp = os.popen("identify -format \"%w %h\""
+                          + commands.mkarg(infile))
             words = fp.read().split()
             fp.close()
             w = int(words[0])
@@ -51,12 +53,15 @@ class ImageCache(object):
 	    if rotation == 0:
 		os.system("djpeg %s"
 			  "|pnmscale -xysize %s %s|cjpeg -optimize > %s" % (
-			infile, self.width, self.height, fn))
+                              commands.mkarg(infile), self.width, self.height,
+                              commands.mkarg(fn)))
 	    else:
 		os.system("jpegtran -rotate %s %s"
 			  "|djpeg"
 			  "|pnmscale -xysize %s %s|cjpeg -optimize > %s" % (
-		    rotation, infile, self.width, self.height, fn))
+                              rotation, commands.mkarg(infile),
+                              self.width, self.height,
+                              commands.mkarg(fn)))
 	return fn
 
     def hint(self, infile, rotation = 0):
-- 
GitLab