diff --git a/module_index.json b/module_index.json index 9a6de68..6695b98 100755 --- a/module_index.json +++ b/module_index.json @@ -337,7 +337,7 @@ "version": "0.10", "author": "Emanuil Rusev & Starbeamrainbowlabs", "description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.", - "lastupdate": 1571614194, + "lastupdate": 1571614692, "optional": false, "extra_data": { "Parsedown.php": "https:\/\/raw.githubusercontent.com\/erusev\/parsedown\/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955\/Parsedown.php", diff --git a/modules/parser-parsedown.php b/modules/parser-parsedown.php index d5feff4..6a9e147 100644 --- a/modules/parser-parsedown.php +++ b/modules/parser-parsedown.php @@ -135,6 +135,12 @@ register_module([ null // environment variables ); if(!is_resource($process_handle)) { + fclose($dest_handle); + fclose($source_handle); + fclose($error_text_handle); + + unlink($cache_file_location); + http_response_code(503); header("cache-control: no-cache, no-store, must-revalidate"); header("content-type: image/png"); @@ -152,6 +158,9 @@ register_module([ if($exit_code !== 0) { fseek($error_text_handle, 0); $error_details = stream_get_contents($error_text_handle); + // Delete the cache file, which is guaranteed to exist because + // we pre-emptively create it above + unlink($cache_file_location); http_response_code(503); header("content-type: image/png");