aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/file_op.rs7
-rw-r--r--src/main.rs2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/file_op.rs b/src/file_op.rs
index 9a06aea..375ff7d 100644
--- a/src/file_op.rs
+++ b/src/file_op.rs
@@ -69,13 +69,14 @@ pub async fn recursive_dir_size(dir: &Path) -> Result<u64, RuntimeError> {
Some(Ok(entry)) => {
if let Ok(metadata) = entry.metadata().await {
if metadata.is_file() {
- // On Unix, we want to filter inodes that we've already seen so we get a more
- // accurate count of real size used on disk.
+ // On Unix, we want to filter inodes that we've already seen so we get a
+ // more accurate count of real size used on disk.
#[cfg(target_family = "unix")]
{
let (device_id, inode) = (metadata.dev(), metadata.ino());
- // Check if this file has been seen before based on its device ID and inode number
+ // Check if this file has been seen before based on its device ID and
+ // inode number
if seen_inodes.read().await.contains(&(device_id, inode)) {
continue;
} else {
diff --git a/src/main.rs b/src/main.rs
index a7166ef..cd54bd8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -461,9 +461,11 @@ async fn api(
let decoded_path = percent_decode_str(&path)
.decode_utf8()
.map_err(|e| RuntimeError::ParseError(path.clone(), e.to_string()))?;
+
// Convert the relative dir to an absolute path on the system.
let sanitized_path = file_utils::sanitize_path(&*decoded_path, true)
.expect("Expected a path to directory");
+
let full_path = config
.path
.canonicalize()