From 6f8a20d8cb836aa1390b6a3f3c2e203eef4e971d Mon Sep 17 00:00:00 2001 From: David Adi Nugroho Date: Sat, 3 Apr 2021 15:17:41 +0700 Subject: [PATCH 1/2] Add port when replacing s3 temporary_url --- src/Illuminate/Filesystem/FilesystemAdapter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Filesystem/FilesystemAdapter.php b/src/Illuminate/Filesystem/FilesystemAdapter.php index 935c413cd6c0..766c021e793c 100644 --- a/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -621,7 +621,7 @@ protected function concatPathToUrl($url, $path) } /** - * Replace the scheme and host of the given UriInterface with values from the given URL. + * Replace the scheme, host and port of the given UriInterface with values from the given URL. * * @param \Psr\Http\Message\UriInterface $uri * @param string $url @@ -631,7 +631,7 @@ protected function replaceBaseUrl($uri, $url) { $parsed = parse_url($url); - return $uri->withScheme($parsed['scheme'])->withHost($parsed['host']); + return $uri->withScheme($parsed['scheme'])->withHost($parsed['host'])->withPort($parsed['port']); } /** From 3aa902f184fdb672e4709e4005917cd8d8e0dfba Mon Sep 17 00:00:00 2001 From: David Adi Nugroho Date: Sat, 3 Apr 2021 17:13:14 +0700 Subject: [PATCH 2/2] Handle nullable port when replacing s3 temporary_url --- src/Illuminate/Filesystem/FilesystemAdapter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/FilesystemAdapter.php b/src/Illuminate/Filesystem/FilesystemAdapter.php index 766c021e793c..1e0f3a7db3bf 100644 --- a/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -631,7 +631,10 @@ protected function replaceBaseUrl($uri, $url) { $parsed = parse_url($url); - return $uri->withScheme($parsed['scheme'])->withHost($parsed['host'])->withPort($parsed['port']); + return $uri + ->withScheme($parsed['scheme']) + ->withHost($parsed['host']) + ->withPort($parsed['port'] ?? null); } /**