From 44750a179c01dff7135c7368626cb38d76dfbc44 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Wed, 25 Mar 2026 11:55:00 -0400 Subject: [PATCH] Require league/uri-components ^7.6, migrate from deprecated Modifier::from() to wrap() Modifier::wrap()/unwrap() were added in league/uri-components 7.6.0, replacing the deprecated Modifier::from()/getUri(). The ^7 constraint allowed resolving to pre-7.6 versions where wrap() doesn't exist, causing runtime errors. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- composer.json | 4 ++-- src/UrlSigner.php | 4 ++-- src/fs/Fs.php | 12 ++++++------ src/web/AssetManager.php | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index f8c1125..ae21612 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,8 @@ "craftcms/cms": "^4.6 || ^5", "craftcms/flysystem": "^1.0.0 || ^2.0.0", "league/flysystem-aws-s3-v3": "^3.15", - "league/uri": "^7", - "league/uri-components": "^7", + "league/uri": "^7.6", + "league/uri-components": "^7.6", "yiisoft/yii2-redis": "^2.0", "yiisoft/yii2-queue": "^2.3.7", "phlak/semver": "^4.1", diff --git a/src/UrlSigner.php b/src/UrlSigner.php index c5052d2..c288d93 100644 --- a/src/UrlSigner.php +++ b/src/UrlSigner.php @@ -19,14 +19,14 @@ public function sign(string $url): string $data = $this->getSigningData($url); $signature = hash_hmac('sha256', $data, $this->signingKey); - return Modifier::from($url)->appendQueryParameters([ + return Modifier::wrap($url)->appendQueryParameters([ $this->signatureParameter => $signature, ]); } private function getSigningData(string $url): string { - return Modifier::from($url) + return Modifier::wrap($url) ->removeQueryParameters($this->signatureParameter) ->sortQuery(); } diff --git a/src/fs/Fs.php b/src/fs/Fs.php index e7bc521..5bdbd44 100644 --- a/src/fs/Fs.php +++ b/src/fs/Fs.php @@ -93,22 +93,22 @@ public function getRootUrl(): ?string public function createUrl(string $path = ''): UriInterface { if ($this->useLocalFs) { - return Modifier::from($this->getLocalFs()->getRootUrl() ?? '/') + return Modifier::wrap($this->getLocalFs()->getRootUrl() ?? '/') ->appendSegment($this->createPath($path)) - ->getUri(); + ->unwrap(); } $baseUrl = App::parseEnv($this->baseUrl); if ($baseUrl) { - return Modifier::from($baseUrl) + return Modifier::wrap($baseUrl) ->appendSegment($this->createPath($path)) - ->getUri(); + ->unwrap(); } - return Modifier::from(Module::getInstance()->getConfig()->cdnBaseUrl) + return Modifier::wrap(Module::getInstance()->getConfig()->cdnBaseUrl) ->appendSegment($this->createBucketPath($path)) - ->getUri(); + ->unwrap(); } /** diff --git a/src/web/AssetManager.php b/src/web/AssetManager.php index f66fd1b..80aab21 100644 --- a/src/web/AssetManager.php +++ b/src/web/AssetManager.php @@ -34,7 +34,7 @@ protected function preparePaths(): void FileHelper::createDirectory($this->basePath); } - $this->baseUrl = Modifier::from((new CpResourcesFs())->createUrl())->removeTrailingSlash(); + $this->baseUrl = Modifier::wrap((new CpResourcesFs())->createUrl())->removeTrailingSlash(); } protected function hash($path): string