feat: encode SFTP paths on Windows in a revised WTF-8 (#3238)

This commit is contained in:
三咲雅 misaki masa 2025-10-13 19:50:46 +08:00 committed by GitHub
parent 554cb52cc5
commit c68e2df8c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
81 changed files with 1393 additions and 459 deletions

View file

@ -3,7 +3,7 @@ use std::{ffi::OsString, io};
use tokio::{select, sync::{mpsc, oneshot}};
use yazi_fs::cha::Cha;
use yazi_macro::ok_or_not_found;
use yazi_shared::url::{AsUrl, UrlBuf, UrlLike};
use yazi_shared::url::{AsUrl, Url, UrlBuf, UrlLike};
use crate::provider;
@ -63,23 +63,27 @@ async fn _unique_name(mut url: UrlBuf, append: bool) -> io::Result<UrlBuf> {
Ok(url)
}
pub fn copy_with_progress(
from: &UrlBuf,
to: &UrlBuf,
cha: Cha,
) -> mpsc::Receiver<Result<u64, io::Error>> {
pub fn copy_with_progress<U, V>(from: U, to: V, cha: Cha) -> mpsc::Receiver<Result<u64, io::Error>>
where
U: AsUrl,
V: AsUrl,
{
_copy_with_progress(from.as_url(), to.as_url(), cha)
}
fn _copy_with_progress(from: Url, to: Url, cha: Cha) -> mpsc::Receiver<Result<u64, io::Error>> {
let (prog_tx, prog_rx) = mpsc::channel(1);
let (done_tx, mut done_rx) = oneshot::channel();
tokio::spawn({
let (from, to) = (from.clone(), to.clone());
let (from, to) = (from.to_owned(), to.to_owned());
async move {
done_tx.send(provider::copy(&from, &to, cha).await).ok();
done_tx.send(provider::copy(from, to, cha).await).ok();
}
});
tokio::spawn({
let (prog_tx, to) = (prog_tx.clone(), to.clone());
let (prog_tx, to) = (prog_tx.to_owned(), to.to_owned());
async move {
let mut last = 0;
let mut done = None;