From: Patrick Canterino Date: Wed, 14 Oct 2026 13:04:59 +0000 (+0200) Subject: Check async ref files before opening. X-Git-Tag: 4.8.0~5^2~3 X-Git-Url: https://git.p6c8.net/jirafeau/pcanterino.git/commitdiff_plain/2d5f96c44be85bab39fa867e27048db4f5ab7a3b Check async ref files before opening. Ref files MUST be files, not directories. Ref files MUST NOT be emtpy. --- diff --git a/lib/functions.php b/lib/functions.php index 07e5c02..0676c6f 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1022,11 +1022,16 @@ function jirafeau_get_async_ref($ref) $out = array(); $refinfos = VAR_ASYNC . s2p("$ref") . "$ref"; - if (!file_exists($refinfos)) { + if (!is_file($refinfos)) { return $out; } $c = file($refinfos); + + if(empty($c)) { + return $out; + } + $out['file_name'] = trim($c[0]); $out['mime_type'] = trim($c[1]); $out['key'] = trim($c[2], NL); @@ -1132,6 +1137,7 @@ function jirafeau_async_push($ref, $data, $code, $max_file_size) if (count($a) == 0) { return "Error: cannot find transfer"; } + if ($a['next_code'] != "$code") { return "Error: bad transfer code"; }