Merge pull request #299 from Calinou/provider-tweak-error-message

Tweak error message on invalid download commit if not using Custom provider
This commit is contained in:
Emi
2023-10-03 11:24:26 +02:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ class Utils
if ($provider != 'Custom') {
// Git commits are either 40 (SHA1) or 64 (SHA2) hex characters
if (sizeof(preg_grep('/^[a-f0-9]{40}([a-f0-9]{24})?$/', [$commit])) == 0) {
$warning[] = "Using git tags or branches is no longer supported. Please give a full git commit hash instead.\n";
$warning[] = "Using Git tags or branches is no longer supported. Please give a full Git commit hash instead, or use the Custom download provider for GitHub Releases downloads.\n";
}
}
switch ($provider) {

View File

@@ -106,7 +106,7 @@ function _insert_asset_edit_fields($c, $error, &$response, $query, $body, $requi
// Git commits are either 40 (SHA1) or 64 (SHA2) hex characters
if (sizeof(preg_grep('/^[a-f0-9]{40}([a-f0-9]{24})?$/', [$body['download_commit']])) == 0) {
$error = $c->utils->ensureLoggedIn($error, $response, $body, $user);
$error = $c->utils->errorResponseIfNotUserHasLevel($error, $response, $user, 'moderator', 'Using git tags or branches is no longer supported. Please give a full git commit hash instead.');
$error = $c->utils->errorResponseIfNotUserHasLevel($error, $response, $user, 'moderator', 'Using Git tags or branches is no longer supported. Please give a full Git commit hash instead, or use the Custom download provider for GitHub Releases downloads.');
if ($error) {
return $response;
}