Skip to content

Commit 39124fb

Browse files
fix(desktop): disk space detection on overlay fs (hoppscotch#5226)
1 parent eecaa74 commit 39124fb

File tree

9 files changed

+37
-31
lines changed

9 files changed

+37
-31
lines changed

packages/hoppscotch-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@hoppscotch/httpsnippet": "3.0.9",
4040
"@hoppscotch/js-sandbox": "workspace:^",
4141
"@hoppscotch/kernel": "workspace:^",
42-
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce",
42+
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31",
4343
"@hoppscotch/ui": "0.2.5",
4444
"@hoppscotch/vue-toasted": "0.1.0",
4545
"@lezer/highlight": "1.2.0",

packages/hoppscotch-desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@fontsource-variable/material-symbols-rounded": "5.1.3",
1717
"@fontsource-variable/roboto-mono": "5.1.0",
1818
"@hoppscotch/kernel": "workspace:^",
19-
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce",
19+
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31",
2020
"@hoppscotch/ui": "0.2.1",
2121
"@tauri-apps/api": "2.1.1",
2222
"@tauri-apps/plugin-process": "2.2.0",

packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 - CuriousCorrelation
3+
Copyright (c) 2025 - CuriousCorrelation
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ Requirements:
100100

101101
## License
102102

103-
Code: (c) 2024 - CuriousCorrelation
103+
Code: (c) 2025 - CuriousCorrelation
104104

105105
MIT or MIT/Apache 2.0 where applicable.

packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 CuriousCorrelation
1+
// Copyright 2025 CuriousCorrelation
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/manager.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,26 +153,32 @@ impl StorageManager {
153153
StorageError::Io(e)
154154
})?;
155155

156+
// Convert both paths to the same format for comparison, Windows...
157+
let normalized_storage = dunce::canonicalize(&storage_path).unwrap_or(storage_path.clone());
158+
156159
// NOTE: There cannot be more than one user config storage disk,
157160
// although even if there is, defaulting to the first one we found
158161
// is as good of a guess as any.
159-
let disk = disks.into_iter().find(|disk| {
160-
// Convert both paths to the same format for comparison, Windows...
161-
let normalized_storage =
162-
dunce::canonicalize(&storage_path).unwrap_or(storage_path.clone());
163-
let normalized_disk = dunce::canonicalize(disk.mount_point())
164-
.unwrap_or_else(|_| disk.mount_point().to_path_buf());
165-
166-
normalized_storage.starts_with(&normalized_disk)
167-
});
168-
169-
let Some(disk) = disk else {
170-
tracing::error!(
171-
storage_path = %storage_path.display(),
172-
"Fatal error, unable to resolve user config storage disk"
173-
);
174-
return Err(StorageError::DiskNotFound);
175-
};
162+
// Find the disk with the longest matching mount point
163+
let disk = disks
164+
.into_iter()
165+
.filter_map(|disk| {
166+
let normalized_disk = dunce::canonicalize(disk.mount_point())
167+
.unwrap_or_else(|_| disk.mount_point().to_path_buf());
168+
169+
normalized_storage
170+
.starts_with(&normalized_disk)
171+
.then_some((disk, normalized_disk))
172+
})
173+
.max_by_key(|(_, normalized_disk)| normalized_disk.as_os_str().len())
174+
.map(|(disk, _)| disk)
175+
.ok_or_else(|| {
176+
tracing::error!(
177+
storage_path = %storage_path.display(),
178+
"Fatal error, unable to resolve user config storage disk"
179+
);
180+
StorageError::DiskNotFound
181+
})?;
176182

177183
let available = disk.available_space();
178184

packages/hoppscotch-desktop/src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/hoppscotch-desktop/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ tauri-plugin-store = "2.2.0"
2929
tauri-plugin-dialog = "2.2.0"
3030
tauri-plugin-fs = "2.2.0"
3131
tauri-plugin-deep-link = "2.2.0"
32-
tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "0308b55e82f7f01d878a7fdf0f597d1dc975f2ce" }
32+
tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "1b52e49d881926135838cf6cfebdc1643a9bec31" }
3333
tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "0147ac1bb29d3b88d6652432a482bd86f0174506" }
3434
axum = "0.8.1"
3535
tower-http = { version = "0.6.2", features = ["cors"] }

pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)