[OEmbed] Revert filename change introduced with 96ce758c
This commit is contained in:
parent
01b5118c6f
commit
f717081893
@ -37,7 +37,7 @@ defined('GNUSOCIAL') || die();
|
|||||||
*/
|
*/
|
||||||
class OembedPlugin extends Plugin
|
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', ...));
|
// 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
|
// 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']);
|
$ext = File::guessMimeExtension($info['mime']);
|
||||||
|
|
||||||
try {
|
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);
|
$fullpath = File_thumbnail::path($filename);
|
||||||
// Write the file to disk. Throw Exception on failure
|
// Write the file to disk. Throw Exception on failure
|
||||||
if (!file_exists($fullpath) && file_put_contents($fullpath, $imgData) === false) {
|
if (!file_exists($fullpath) && file_put_contents($fullpath, $imgData) === false) {
|
||||||
|
Loading…
Reference in New Issue
Block a user