From e0fc832621aca9e655dc8e7c23fa66a8b1bbe8d6 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Thu, 8 Apr 2021 21:21:27 -0700 Subject: [PATCH] Better GPM detection of unauthorized installations --- CHANGELOG.md | 6 ++++++ system/src/Grav/Console/Gpm/InstallCommand.php | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e0a029e5..bb5a006fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.11 +## mm/dd/2021 + +1. [](#improved) + * Better GPM detection of unauthorized installations + # v1.7.10 ## 04/06/2021 diff --git a/system/src/Grav/Console/Gpm/InstallCommand.php b/system/src/Grav/Console/Gpm/InstallCommand.php index 202427cff..92c8e07d7 100644 --- a/system/src/Grav/Console/Gpm/InstallCommand.php +++ b/system/src/Grav/Console/Gpm/InstallCommand.php @@ -600,7 +600,13 @@ class InstallCommand extends GpmCommand try { $output = Response::get($package->zipball_url . $query, [], [$this, 'progress']); } catch (Exception $e) { - $error = str_replace("\n", "\n | '- ", $e->getMessage()); + if (!empty($package->premium) && $e->getCode() === 401) { + $message = 'Unauthorized Premium License Key'; + } else { + $message = $e->getMessage(); + } + + $error = str_replace("\n", "\n | '- ", $message); $io->write("\x0D"); // extra white spaces to clear out the buffer properly $io->writeln(' |- Downloading package... error ');