viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Fix a bug that was preventing PDFs from being displayed on pollett.org, a=chris

Chris Pollett [2020-08-06 03:Aug:th]
Fix a bug that was preventing PDFs from being displayed on pollett.org, a=chris
Filename
src/controllers/components/SocialComponent.php
src/executables/Fetcher.php
src/models/GroupModel.php
diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php
index bf45d9d14..57c296491 100644
--- a/src/controllers/components/SocialComponent.php
+++ b/src/controllers/components/SocialComponent.php
@@ -3953,7 +3953,7 @@ EOD;
     private function addPdfMediaScripts($file_name, &$data)
     {
         $data['INCLUDE_SCRIPTS'][] = 'pdf.js/build/pdf';
-        $book_name = "b" . str_replace('-', "_", L\crawlHash($file_name));
+        $book_name = "b" . str_replace('-', "_", L\crawlHash(trim($file_name)));
         $doc_sections = tl('social_component_doc_sections');
         $data['SCRIPT'] .= <<< EOD
             var $book_name = {};
diff --git a/src/executables/Fetcher.php b/src/executables/Fetcher.php
index 4e8171707..8b52ce5db 100755
--- a/src/executables/Fetcher.php
+++ b/src/executables/Fetcher.php
@@ -1680,7 +1680,6 @@ class Fetcher implements CrawlConstants
                     $extension);
                 unset($this->to_crawl_again[$delete_index]);
             }
-
             if ($repository_type == self::REPOSITORY_GIT) {
                 if (!$git_set) {
                     $next_url_start = $url_to_check . self::GIT_URL_CONTINUE.
diff --git a/src/models/GroupModel.php b/src/models/GroupModel.php
index 1071c32b4..fd2373b4f 100644
--- a/src/models/GroupModel.php
+++ b/src/models/GroupModel.php
@@ -2049,9 +2049,9 @@ class GroupModel extends Model implements MediaConstants
             } else if (($mime_type =='application/epub+zip' &&
                 file_exists(C\APP_DIR. "/scripts/epub.js")) ||
                 ($mime_type =='application/pdf' &&
-                file_exists(C\APP_DIR. "/scripts/pdf.js"))) {
+                file_exists(C\APP_DIR . "/scripts/pdf.js"))) {
                 $book_name = "b" . str_replace("-", "_",
-                    L\crawlHash($resource_description));
+                    L\crawlHash(trim($resource_description)));
                 $replace_string =
                     "<script>\n".
                     "{$book_name}_url = '" . html_entity_decode(
ViewGit