This commit is contained in:
sxyazi 2025-10-13 19:36:23 +08:00
parent caafaa5d40
commit b2c6d673c1
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View file

@ -47,7 +47,7 @@ impl<'a> ByteStr<'a> {
#[cfg(windows)]
{
match super::wtf::bytes_to_wide(self.0.as_ref()) {
Cow::Borrowed(_) => self.0.into_owned(),
Cow::Borrowed(_) => unsafe { String::from_utf8_unchecked(self.0.into_owned()) }.into(),
Cow::Owned(s) => s,
}
}
@ -102,7 +102,7 @@ where
}
#[cfg(windows)]
{
super::wtf::wide_to_bytes(self.as_ref())
super::wtf::wide_to_bytes(self.as_ref().as_os_str())
.ok_or(Error::custom("failed to convert wide path to bytes"))
.map(ByteStr)
}

View file

@ -85,8 +85,8 @@ impl Provider for Sftp {
let attrs = Attrs::from(Cha(cha));
let op = self.op().await?;
let from = op.open(from.as_ref(), Flags::READ, &Attrs::default()).await?;
let to = op.open(to.as_ref(), Flags::WRITE | Flags::CREATE | Flags::TRUNCATE, &attrs).await?;
let from = op.open(&from, Flags::READ, &Attrs::default()).await?;
let to = op.open(&to, Flags::WRITE | Flags::CREATE | Flags::TRUNCATE, &attrs).await?;
let mut reader = BufReader::with_capacity(524288, from);
let mut writer = BufWriter::with_capacity(524288, to);
@ -101,7 +101,7 @@ impl Provider for Sftp {
where
P: AsRef<Path>,
{
Ok(self.op().await?.mkdir(path.as_ref(), Attrs::default()).await?)
Ok(self.op().await?.mkdir(&path, Attrs::default()).await?)
}
async fn gate(&self) -> io::Result<Self::Gate> {