From fbba43ec3c3c4f96cce34dfef0e4df2b342f1ccd Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Thu, 31 Jan 2008 08:29:50 +0000 Subject: [PATCH] Replace spaces in paths for 'convert' command SVN revision: 2017 --- src/elogd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index 2a85a43e..164a3cb5 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -21946,7 +21946,7 @@ int is_inline_attachment(char *encoding, int message_id, char *text, int i, char int create_thumbnail(LOGBOOK * lbs, char *file_name) { - char str[MAX_PATH_LENGTH], cmd[2*MAX_PATH_LENGTH], thumb_size[256]; + char str[MAX_PATH_LENGTH], str2[MAX_PATH_LENGTH], cmd[2*MAX_PATH_LENGTH], thumb_size[256]; if (!getcfg(lbs->name, "Thumbnail size", thumb_size, sizeof(thumb_size))) return 0; @@ -21966,7 +21966,14 @@ int create_thumbnail(LOGBOOK * lbs, char *file_name) if (file_exist(str)) return 1; - sprintf(cmd, "convert %s -thumbnail \"%s\" %s", file_name, thumb_size, str); + strlcpy(str2, file_name, sizeof(str2)); + +#ifdef OS_UNIX + strsubst(str2, sizeof(str2), " ", "\\ "); + strsubst(str, sizeof(str), " ", "\\ "); +#endif + + sprintf(cmd, "convert \"%s\" -thumbnail \"%s\" \"%s\"", str2, thumb_size, str); sprintf(str, "SHELL \"%s\"", cmd); write_logfile(lbs, str);