Skip to content
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

fix: don't replace slashes on UNIX #832

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions mz_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,10 @@ static int32_t mz_zip_entry_write_header(void *stream, uint8_t local, mz_zip_fil
}

if (err == MZ_OK) {
const char *backslash = NULL;
const char *next = filename;
int32_t left = filename_length;
#if defined(_WIN32)
const char *backslash = NULL;

/* Ensure all slashes are written as forward slashes according to 4.4.17.1 */
while ((err == MZ_OK) && (backslash = strchr(next, '\\'))) {
Expand All @@ -801,7 +802,7 @@ static int32_t mz_zip_entry_write_header(void *stream, uint8_t local, mz_zip_fil
left -= part_length + 1;
next = backslash + 1;
}

#endif
if (err == MZ_OK && left > 0) {
if (mz_stream_write(stream, next, left) != left)
err = MZ_WRITE_ERROR;
Expand Down
Loading