From c057d4e7ee7a64954d0be7ddb544e175de6a904e Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Fri, 13 Mar 2015 17:24:09 +0100 Subject: [PATCH] Make sure an unzipped file has correct extension. If a mask is missing, the TempFile class appends it to the filename. This may be a problem with applications relying on the extension, so explicitly add a mask. --- src/graphics/GraphicsCacheItem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 4d18ce0778..9fab10dbf9 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -362,7 +362,11 @@ bool CacheItem::Impl::tryDisplayFormat(FileName & filename, string & from) zipped_ = formats.isZippedFile(filename_); if (zipped_) { - TempFile tempfile(filename_.toFilesystemEncoding()); + string tempname = unzippedFileName(filename_.toFilesystemEncoding()); + string const ext = getExtension(tempname); + if (!ext.empty()) + tempname = changeExtension(tempname, ""); + TempFile tempfile(tempname + "-XXXXXX." + ext); tempfile.setAutoRemove(false); unzipped_filename_ = tempfile.name(); if (unzipped_filename_.empty()) { -- 2.39.2