From f717081893b11347819b19045fa9258f661e4725 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Thu, 13 Jun 2019 08:18:10 +0100 Subject: [PATCH] [OEmbed] Revert filename change introduced with 96ce758c --- plugins/Oembed/OembedPlugin.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/Oembed/OembedPlugin.php b/plugins/Oembed/OembedPlugin.php index 9230abdb01..93fafe361d 100644 --- a/plugins/Oembed/OembedPlugin.php +++ b/plugins/Oembed/OembedPlugin.php @@ -37,7 +37,7 @@ defined('GNUSOCIAL') || die(); */ class OembedPlugin extends Plugin { - const PLUGIN_VERSION = '2.0.0'; + const PLUGIN_VERSION = '2.0.1'; // settings which can be set in config.php with addPlugin('Oembed', array('param'=>'value', ...)); // WARNING, these are _regexps_ (slashes added later). Always escape your dots and end your strings @@ -579,7 +579,8 @@ class OembedPlugin extends Plugin $ext = File::guessMimeExtension($info['mime']); try { - $filename = sprintf('oembed-%d.%s', $thumbnail->getFileId(), $ext); + // We'll trust sha256 (File::FILEHASH_ALG) not to have collision issues any time soon :) + $filename = sprintf('oembed-%d.%s', hash(File::FILEHASH_ALG, $imgData), $ext); $fullpath = File_thumbnail::path($filename); // Write the file to disk. Throw Exception on failure if (!file_exists($fullpath) && file_put_contents($fullpath, $imgData) === false) {