]> git.p6c8.net - jirafeau/jirafeau.git/commitdiff
Check async ref files before opening.
authorPatrick Canterino <patrick@patrick-canterino.de>
Wed, 14 Oct 2026 13:04:59 +0000 (15:04 +0200)
committerPatrick Canterino <patrick@patrick-canterino.de>
Wed, 14 Oct 2026 13:10:18 +0000 (15:10 +0200)
Ref files MUST be files, not directories.

Ref files MUST NOT be emtpy.

lib/functions.php

index 07e5c02f7b3bb7a05667df4d433e2a9b3b6e3075..0676c6fdd1a996586b192b03fdf125bde9ca9f56 100644 (file)
@@ -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";
     }

patrick-canterino.de