From a44187a5c1bc558becfb85a09c2fb1bcc5e29829 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 27 Oct 2012 02:30:58 -0700 Subject: [PATCH] Cleanup after data validation. Signed-off-by: Edward Z. Yang --- NEWS | 2 ++ library/HTMLPurifier/URIScheme/data.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 9ce4173f..ee0511cc 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Fix bug where background:url() always gets lower-cased (but not background-image:url()) - Fix bug with non lower-case color names in HTML +- Fix bug where data URI validation doesn't remove temporary files. + Thanks Javier MarĂ­n Ros for reporting. 4.4.0, released 2012-01-18 # Removed PEARSax3 handler. diff --git a/library/HTMLPurifier/URIScheme/data.php b/library/HTMLPurifier/URIScheme/data.php index a5c43989..ab56a3e9 100644 --- a/library/HTMLPurifier/URIScheme/data.php +++ b/library/HTMLPurifier/URIScheme/data.php @@ -64,10 +64,12 @@ class HTMLPurifier_URIScheme_data extends HTMLPurifier_URIScheme { file_put_contents($file, $raw_data); if (function_exists('exif_imagetype')) { $image_code = exif_imagetype($file); + unlink($file); } elseif (function_exists('getimagesize')) { set_error_handler(array($this, 'muteErrorHandler')); $info = getimagesize($file); restore_error_handler(); + unlink($file); if ($info == false) return false; $image_code = $info[2]; } else { -- 2.11.4.GIT