mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-21 16:02:20 +00:00
fix(sftp): fold a remote filename where the panel draws it
The file tree stopped drawing raw filenames in 25d1f06, on the reasoning
that it was the one place a name arrives from a filesystem nobody here
chose. That was wrong by one: the SFTP panel draws names from a listing
on *another machine*, which is the same hazard with more claim to it —
gpui breaks a row on a newline whatever the row says, and the bytes are
picked somewhere this window has no say over.
Both sites the panel draws a name at: the entry row, and the transfer
row's `remote_basename`.
Display-only, as before. `entry.name` is what `remote_join` builds every
download, delete and rename path from, at five call sites, and a `↵`
spliced into one of those names nothing on the server. Checked after the
fact that every `one_line` in the file sits in a label.
Found by re-reading the scoping note from that commit while auditing
something else. It said only the file tree took names from an arbitrary
filesystem, and listed where not to bother. A remote listing is more
arbitrary than a local one, not less.
This commit is contained in:
+9
-3
@@ -20,6 +20,7 @@ use crate::daemon::protocol::{
|
||||
};
|
||||
use crate::daemon::ssh::sftp::{remote_basename, remote_join, remote_parent, safe_local_name};
|
||||
use crate::terminal::RemoteTerminal;
|
||||
use crate::terminal::view::one_line;
|
||||
use crate::ui::app::{CONTENT_INSET, TILE_GLYPH_SM, TILE_SIZE_SM, Tty7App};
|
||||
use crate::ui::i18n::{L10nKey, t, t_fmt};
|
||||
use crate::ui::right_panel::{META, TEXT};
|
||||
@@ -1484,10 +1485,15 @@ impl Tty7App {
|
||||
} else {
|
||||
human_size(entry.size)
|
||||
};
|
||||
// Folded exactly as the file tree folds its rows, and for a name with
|
||||
// more claim to it: this one came off another machine's listing, so it
|
||||
// is bytes chosen somewhere this window has no say over. `entry.name`
|
||||
// itself is untouched — it is what `remote_join` builds the download's
|
||||
// path from, and a `↵` spliced into that names nothing on the server.
|
||||
let name_label = if is_symlink {
|
||||
format!("{} →", entry.name)
|
||||
format!("{} →", one_line(&entry.name))
|
||||
} else {
|
||||
entry.name.clone()
|
||||
one_line(&entry.name)
|
||||
};
|
||||
let row_id = SharedString::from(format!("sftp-row-{}", entry.name));
|
||||
|
||||
@@ -1841,7 +1847,7 @@ impl Tty7App {
|
||||
.text_xs()
|
||||
.text_color(foreground)
|
||||
.truncate()
|
||||
.child(format!("{arrow} {name}")),
|
||||
.child(format!("{arrow} {}", one_line(&name))),
|
||||
)
|
||||
.when(done_download, |this| {
|
||||
this.child(
|
||||
|
||||
Reference in New Issue
Block a user