New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory separator conflicts with PharData file path #168
Comments
And maybe it is possible to extract file exact to $this->getDatabasePath()? location/src/Drivers/MaxMind.php Line 49 in c95c397
It leaves extracted junk files. |
What do you suggest? Should we create |
Since the FilesystemIterator::UNIX_PATHS flag used in PharData, changing DIRECTORY_SEPARATOR to '/' in location/src/Drivers/MaxMind.php Line 45 in c95c397
should be enough. |
What can you say about junk files? location/src/Drivers/MaxMind.php Line 44 in c95c397
$tmpDirectory = Str::afterLast($file->getPath(), '/'); // add var and unix-separator
if ($tmpDirectory == $tar) { // check if in the future the .mmdb file will be in the root of archive
$relativePath = $file->getFilename();
} else {
$relativePath = implode('/', [
$tmpDirectory,
$file->getFilename(),
]);
}
$archive->extractTo($storage->path('/'), $relativePath, true);
$dataBasePath = $this->getDatabasePath();
file_put_contents(
$dataBasePath,
fopen($storage->path($relativePath), 'r')
);
if ($tmpDirectory == $tar && !Str::endsWith($dataBasePath, DIRECTORY_SEPARATOR.$relativePath)) { // in case of db file name from config equals db file name from maxmind
$storage->delete($relativePath);
} else {
$storage->deleteDirectory($tmpDirectory); // delete dir and it's files
}
$storage->delete($tar); |
PharData has FilesystemIterator::UNIX_PATHS flag as default in constructor (https://www.php.net/manual/en/phardata.construct.php, https://www.php.net/manual/en/class.filesystemiterator.php#filesystemiterator.constants.unix-paths).
However, DIRECTORY_SEPARATOR is used in
location/src/Drivers/MaxMind.php
Line 45 in c95c397
The text was updated successfully, but these errors were encountered: