--- a/ooo-thumbnailer
+++ b/ooo-thumbnailer
@@ -31,7 +31,7 @@
 test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && source ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs
 
 # documents in the Templates directory are ignored
-if [ `dirname "$ifile"` != ${XDG_TEMPLATES_DIR:-$HOME/Templates} ]; then
+if [ "`dirname "$ifile"`" != ${XDG_TEMPLATES_DIR:-$HOME/Templates} ]; then
   # use imagemagick if it's installed
   # (currently, always the case until GNOME bug #576750 is fixed and 
   # dependency on imagemagick is removed)
