Skip to content

Commit

Permalink
Correctly handling backslashes in ZIP file entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
krulis-martin committed Dec 16, 2024
1 parent eff5954 commit b7541f8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/helpers/FileStorage/LocalStorage/LocalFileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ private static function normalizePath(string $path): string
*/
private function decodePath(string &$path, bool $exists = null, $mkdir = false): array
{
$path = self::normalizePath($path);

$tokens = explode('#', $path, 2);
array_push($tokens, null); // make sure second item always exists
[$realPath, $zipEntry] = $tokens;

$realPath = $this->rootDirectory . '/' . $realPath;
$realPath = $this->rootDirectory . '/' . self::normalizePath($realPath);
if (is_dir($realPath)) {
throw new FileStorageException("Given path refers to a directory.", $path);
}
Expand Down

0 comments on commit b7541f8

Please sign in to comment.