Open
Description
PHP: 8.2
Laravel: 10.15
Airdrop: 0.2.4
When running the airdrop:download
or airdrop:upload
commands, the following errors comes up:
TypeError
Hammerstone\Airdrop\FileSelection::shouldExclude(): Argument #1 ($path) must be of type string, Symfony\Component\Finder\SplFileInfo given, called in /var/www/html/vendor/hammerstone/airdrop/src/FileSelection.php on line 116
at vendor/hammerstone/airdrop/src/FileSelection.php:152
148▕ })
149▕ ->toArray();
150▕ }
151▕
➜ 152▕ protected function shouldExclude(string $path): bool
153▕ {
154▕ foreach ($this->excludeFilesAndDirectories as $excludedPath) {
155▕ if (Str::startsWith(realpath($path), $excludedPath)) {
156▕ return true;
+1 vendor frames
2 [internal]:0
Hammerstone\Airdrop\FileSelection::yieldSelectedFiles()
+22 vendor frames
25 artisan:35
Illuminate\Foundation\Console\Kernel::handle()
This is caused by this line. The iterator is an iterator of Symfony\Component\Finder\SplFileInfo
, not string.
The fix seems to be to pass the realpath from the Symfony object and remove the realpath
function call in the shouldExclude
function.
Doing this locally causes Airdrop to function as expected.
Metadata
Assignees
Labels
No labels