Fixes an issue in fetch controllre if a queue server doesn't have a new schedule ready

Chris Pollett [2023-09-10 03:Sep:th]
Fixes an issue in fetch controllre if a queue server doesn't have a new schedule ready
Filename
src/controllers/FetchController.php
src/library/Utility.php
diff --git a/src/controllers/FetchController.php b/src/controllers/FetchController.php
index 7c4445e52..8e7c04151 100755
--- a/src/controllers/FetchController.php
+++ b/src/controllers/FetchController.php
@@ -150,7 +150,14 @@ class FetchController extends Controller implements CrawlConstants
                 self::messages_data_base_name .  $crawl_time;
             $messages_bundle = new MessagesBundle($messages_folder);
             $messages_bundle->initWindows();
+            // get a schedule if exists, else false
             $message = $messages_bundle->extractSendWindow();
+            if (!$message) {
+                $message = $data['MESSAGE'];
+            }
+            /* this gets a ready for further processing file from receive window
+               if exists, and moves it to other folder for further processing
+             */
             $packed_data = $messages_bundle->extractReceiveWindow();
             if (!empty($packed_data)) {
                 list($byte_counts, $upload_data) = unserialize(
diff --git a/src/library/Utility.php b/src/library/Utility.php
index 9098def11..8321d00d0 100755
--- a/src/library/Utility.php
+++ b/src/library/Utility.php
@@ -1576,7 +1576,8 @@ function webencode($str)
  */
 function webdecode($str)
 {
-    return base64_decode(strtr($str, ["." => "+", "~" => "=", "_" => "/"]));
+    return base64_decode(strtr($str ?? "",
+        ["." => "+", "~" => "=", "_" => "/"]));
 }
 /**
  * The crawlHash function is used to encrypt passwords stored in the database.
ViewGit