From 5a56cc5a0c468b368f49587bcdf6448e46fb7d65 Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Thu, 20 Jun 2024 09:57:32 -0400 Subject: [PATCH] Fix extraction and clean up --- src/Drivers/MaxMind.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Drivers/MaxMind.php b/src/Drivers/MaxMind.php index 895fefd..99c706f 100644 --- a/src/Drivers/MaxMind.php +++ b/src/Drivers/MaxMind.php @@ -46,19 +46,19 @@ public function update(Command $command): void $file = $this->discoverDatabaseFile($archive); - $relativePath = implode('/', [ - Str::afterLast($file->getPath(), DIRECTORY_SEPARATOR), - $file->getFilename(), - ]); + $directory = Str::afterLast($file->getPath(), DIRECTORY_SEPARATOR); + + $relativePath = implode('/', [$directory, $file->getFilename()]); $archive->extractTo($storage->path('/'), $relativePath, true); file_put_contents( $this->getDatabasePath(), - fopen($storage->path($file->getFilename()), 'r') + fopen($storage->path($relativePath), 'r') ); $storage->delete($tarFileName); + $storage->deleteDirectory($directory); } /**