From 274605a0e8c0a5699b5f711e7dd2b4959bba7315 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Tue, 5 Nov 2024 14:04:56 -0600 Subject: [PATCH] Fix incorrect filesystem determination and simplify hash calculation --- lib/Ebook.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Ebook.php b/lib/Ebook.php index 9cb53d89..14f0fe73 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -314,8 +314,7 @@ class Ebook{ } private function GetLatestCommitHash(): string{ - $gitCommits = $this->GitCommits; - return substr(sha1($gitCommits[0]->Created->format('U') . ' ' . $gitCommits[0]->Message), 0, 8); + return substr(sha1($this->GitCommits[0]->Hash), 0, 8); } protected function GetHeroImageUrl(): string{ @@ -606,7 +605,7 @@ class Ebook{ $ebookFromFilesystem = new Ebook(); // First, construct a source repo path from our WWW filesystem path. - if(str_starts_with($wwwFilesystemPath, '/')){ + if(is_dir($wwwFilesystemPath . '/.git')){ $ebookFromFilesystem->RepoFilesystemPath = $wwwFilesystemPath; } else{