fix: incorrect seperator for zip archives under windows

pull/577/head
Matthias Möller 2025-04-24 17:58:07 +02:00
parent 8a92a0cf1a
commit 0a6c0ae50e
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,
};