mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
SCP File transfer: when listing directory entries, check if a symlink points to a directory or to a file
This commit is contained in:
@@ -18,6 +18,7 @@ FIXME: Released on
|
|||||||
|
|
||||||
- Bugfix:
|
- Bugfix:
|
||||||
- Solved file index in explorer files at start of termscp, in case the first entry is an hidden file
|
- Solved file index in explorer files at start of termscp, in case the first entry is an hidden file
|
||||||
|
- SCP File transfer: when listing directory entries, check if a symlink points to a directory or to a file
|
||||||
|
|
||||||
## 0.3.1
|
## 0.3.1
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,8 @@ impl ScpFileTransfer {
|
|||||||
}
|
}
|
||||||
// Collect metadata
|
// Collect metadata
|
||||||
// Get if is directory and if is symlink
|
// Get if is directory and if is symlink
|
||||||
let (is_dir, is_symlink): (bool, bool) = match metadata.get(1).unwrap().as_str() {
|
let (mut is_dir, is_symlink): (bool, bool) = match metadata.get(1).unwrap().as_str()
|
||||||
|
{
|
||||||
"-" => (false, false),
|
"-" => (false, false),
|
||||||
"l" => (false, true),
|
"l" => (false, true),
|
||||||
"d" => (true, false),
|
"d" => (true, false),
|
||||||
@@ -135,12 +136,21 @@ impl ScpFileTransfer {
|
|||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
};
|
};
|
||||||
// Get filesize
|
// Get filesize
|
||||||
let filesize: usize = metadata.get(6).unwrap().as_str().parse::<usize>().unwrap_or(0);
|
let filesize: usize = metadata
|
||||||
|
.get(6)
|
||||||
|
.unwrap()
|
||||||
|
.as_str()
|
||||||
|
.parse::<usize>()
|
||||||
|
.unwrap_or(0);
|
||||||
// Get link and name
|
// Get link and name
|
||||||
let (file_name, symlink_path): (String, Option<PathBuf>) = match is_symlink {
|
let (file_name, symlink_path): (String, Option<PathBuf>) = match is_symlink {
|
||||||
true => self.get_name_and_link(metadata.get(8).unwrap().as_str()),
|
true => self.get_name_and_link(metadata.get(8).unwrap().as_str()),
|
||||||
false => (String::from(metadata.get(8).unwrap().as_str()), None),
|
false => (String::from(metadata.get(8).unwrap().as_str()), None),
|
||||||
};
|
};
|
||||||
|
// Check if symlink points to a directory
|
||||||
|
if let Some(symlink_path) = symlink_path.as_ref() {
|
||||||
|
is_dir = symlink_path.is_dir();
|
||||||
|
}
|
||||||
// Get symlink
|
// Get symlink
|
||||||
let symlink: Option<Box<FsEntry>> = match symlink_path {
|
let symlink: Option<Box<FsEntry>> = match symlink_path {
|
||||||
None => None,
|
None => None,
|
||||||
|
|||||||
Reference in New Issue
Block a user