From 2e3544f296a33414a40307c8e1440fd26abba0d5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 16 Oct 2023 22:58:49 +0200 Subject: [PATCH] catch exception when license path key is not set, fix libxslt license --- config/source.json | 2 +- src/SPC/util/LicenseDumper.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/source.json b/config/source.json index 84d16d16..a7af224f 100644 --- a/config/source.json +++ b/config/source.json @@ -270,7 +270,7 @@ "regex": "/href=\"(?libxslt-(?[^\"]+)\\.tar\\.xz)\"/", "license": { "type": "file", - "text": "COPYING" + "path": "COPYING" } }, "libyaml": { diff --git a/src/SPC/util/LicenseDumper.php b/src/SPC/util/LicenseDumper.php index d5f43909..196ca365 100644 --- a/src/SPC/util/LicenseDumper.php +++ b/src/SPC/util/LicenseDumper.php @@ -102,8 +102,11 @@ class LicenseDumper /** * @throws RuntimeException */ - private function loadSourceFile(string $source_name, string $in_path, ?string $custom_base_path = null): string + private function loadSourceFile(string $source_name, ?string $in_path, ?string $custom_base_path = null): string { + if (is_null($in_path)) { + throw new RuntimeException('source [' . $source_name . '] license file is not set, please check config/source.json'); + } if (!file_exists(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $in_path)) { throw new RuntimeException('source [' . $source_name . '] license file [' . $in_path . '] not exist'); }