X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/3529495482bde49c353d7338c81b8dc8fbae197a..ef82d9482cca75efe13a50198677073be9e91d5f:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index 2843e29..0372507 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -623,7 +623,7 @@ function jirafeau_is_viewable($mime) if (!empty($mime)) { $viewable = array('image', 'video', 'audio'); $decomposed = explode('/', $mime); - if (in_array($decomposed[0], $viewable) && strpos($mime, 'image/svg+xml') === false) { + if (in_array($decomposed[0], $viewable) && stripos($mime, 'image/svg+xml') === false) { return true; } $viewable = array('text/plain'); @@ -1197,6 +1197,11 @@ function jirafeau_async_end($ref, $code, $crypt, $link_name_length, $file_hash_m return "Error: referenced file does not exist"; } + /* Store filesize before encrypting the file */ + /* Otherwise we would send the size of the encrypted file and the data of the unencrypted file */ + /* This would break some browsers */ + $size = filesize($p); + $crypted = false; $crypt_key = ''; if ($crypt == true && extension_loaded('sodium') == true) { @@ -1209,7 +1214,6 @@ function jirafeau_async_end($ref, $code, $crypt, $link_name_length, $file_hash_m } $hash = jirafeau_hash_file($file_hash_method, $p); - $size = filesize($p); $np = s2p($hash); $delete_link_code = jirafeau_gen_random(5);