fix: incorrect seperator for zip archives under windows (#577)

pull/583/head
Matthias Möller 2025-04-25 02:14:21 +02:00 committed by GitHub
parent 8a92a0cf1a
commit 53f064c73b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -37,7 +37,7 @@ use std::collections::HashMap;
use std::fs::Metadata;
use std::io::SeekFrom;
use std::net::SocketAddr;
use std::path::{Component, Path, PathBuf};
use std::path::{Component, Path, PathBuf, MAIN_SEPARATOR};
use std::sync::atomic::{self, AtomicBool};
use std::sync::Arc;
use std::time::SystemTime;
@ -1644,7 +1644,12 @@ async fn zip_dir<W: AsyncWrite + Unpin>(
))
.await?;
for zip_path in zip_paths.into_iter() {
let filename = match zip_path.strip_prefix(dir).ok().and_then(|v| v.to_str()) {
let filename = match zip_path
.strip_prefix(dir)
.ok()
.and_then(|v| v.to_str())
.map(|v| v.replace(MAIN_SEPARATOR, "/"))
{
Some(v) => v,
None => continue,
};