stevebauman / location

Detect a users location by their IP Address.
MIT License
1.1k stars 177 forks source link

phar error: attempted to extract non-existent file or directory on location:update #179

Closed 3likayed closed 4 months ago

3likayed commented 4 months ago

Hello i'm using the last version of the package ^7.3.1 on windows when calling the artisan command

php artisan location:update

i get this phar exception


   PharException

phar error: attempted to extract non-existent file or directory "phar://E:/latest/database/maxmind.tar.gz/GeoLite2-City_20240628\GeoLite2-City.mmdb" from phar "E:/latest/database/maxmind.tar.gz"

at vendor\stevebauman\location\src\Drivers\MaxMind.php:52
48▕
49▕         $directory = Str::afterLast($file->getPath(), DIRECTORY_SEPARATOR);
50▕
51▕         $relativePath = implode('/', [$directory, $file->getFilename()]);
➜  52▕         $archive->extractTo($storage->path('/'), $relativePath, true);
53▕
54▕         file_put_contents(
55▕             $this->getDatabasePath(),
56▕             fopen($storage->path($relativePath), 'r')

1   vendor\stevebauman\location\src\Drivers\MaxMind.php:52
PharData::extractTo("E:\latest\database\", "phar://E:/lat/database/maxmind.tar.gz/GeoLite2-City_20240628\GeoLite2-City.mmdb")

2   vendor\stevebauman\location\src\Commands\Update.php:34
Stevebauman\Location\Drivers\MaxMind::update(Object(Stevebauman\Location\Commands\Update))

this issue was mentioned before here #177 Thanks,

3likayed commented 4 months ago

pr #180

stevebauman commented 4 months ago

Thanks again for the PR @3likayed 🙏

I've just released v7.3.2 that contains your patch.