-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Handle zips with Windoze directory separators (\
) rather than the standard linux (/
)
#3482
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
Handle zips with Windoze directory separators (\
) rather than the standard linux (/
)
#3482
Conversation
Needs Tests still |
…tandard linux (`/`)
e72a269
to
fea38ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trapped about this during development. Seems to work properly while applying those changes manually.
I've fixed some typos.
if ($contents === false) { | ||
$contents = $archive->getFromName(substr($fileName, 1), 0, ZipArchive::FL_NOCASE); | ||
} | ||
|
||
// Has the file been saved with Windoze directory separators rather than unix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Has the file been saved with Windoze directory separators rather than unix? | |
// Has the file been saved with Windows directory separators rather than unix? |
@@ -156,7 +156,11 @@ public static function assertFile(string $filename, string $zipMember = ''): voi | |||
if ($zipMember !== '') { | |||
$zipfile = "zip://$filename#$zipMember"; | |||
if (!self::fileExists($zipfile)) { | |||
throw new ReaderException("Could not find zip member $zipfile"); | |||
// Has the file been saved with Windoze directory separators rather than unix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Has the file been saved with Windoze directory separators rather than unix? | |
// Has the file been saved with Windows directory separators rather than unix? |
return true; | ||
} | ||
|
||
// Has the file been saved with Windoze directory separators rather than unix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Has the file been saved with Windoze directory separators rather than unix? | |
// Has the file been saved with Windows directory separators rather than unix? |
I still don't know how this file was created. All versions of Excel itself have always used the unix
Not so much typos, slightly more deliberate ;-) |
I'm using WSL. Before the latest (windows) update everything works fine. Maybe @cameronjohnson-mz is using WSL, too? My reproducer file gets automatically created each night during an automatic process (using an older version of PHPSpreadsheet and) running under WSL. But I don't find the reason why the directory separator gets changed if it hardcoded in the |
This is:
Checklist:
Why this change is needed?
Issue #3472
The sample file uses Windows directory separators rather than linux separators in the zip, so files can't be found in the archive