From d58ac00ce386ae955ca2699a33b315b6cdcbc319 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Sat, 29 Feb 2020 22:37:11 -0600 Subject: [PATCH] Remove trailing slash from dir name in GitHub web hook --- www/webhooks/github.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/webhooks/github.php b/www/webhooks/github.php index 35290f89..de80bfa2 100644 --- a/www/webhooks/github.php +++ b/www/webhooks/github.php @@ -59,17 +59,17 @@ try{ } // Get the filesystem path for the ebook ID. - $dir = REPOS_PATH . '/' . $repoName . '.git/'; + $dir = REPOS_PATH . '/' . $repoName . '.git'; // Confirm we're looking at a Git repo in our filesystem - if(!file_exists($dir . 'HEAD')){ + if(!file_exists($dir . '/HEAD')){ // We might be looking for a repo whose name is so long, it was truncated for GitHub. Try to check that here by simply globbing the rest. $dirs = glob(REPOS_PATH . '/' . $repoName . '*'); if(sizeof($dirs) == 1){ - $dir = rtrim($dirs[0], '/') . '/'; + $dir = rtrim($dirs[0], '/'); } - if(!file_exists($dir . 'HEAD')){ + if(!file_exists($dir . '/HEAD')){ throw new WebhookException('Couldn\'t find repo "' . $repoName . '" in filesystem at "' . $dir . '".', $post); } }