diff --git a/packages/hoppscotch-common/package.json b/packages/hoppscotch-common/package.json index 4d3b661d..f634b5c2 100644 --- a/packages/hoppscotch-common/package.json +++ b/packages/hoppscotch-common/package.json @@ -39,7 +39,7 @@ "@hoppscotch/httpsnippet": "3.0.9", "@hoppscotch/js-sandbox": "workspace:^", "@hoppscotch/kernel": "workspace:^", - "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce", + "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31", "@hoppscotch/ui": "0.2.5", "@hoppscotch/vue-toasted": "0.1.0", "@lezer/highlight": "1.2.0", diff --git a/packages/hoppscotch-desktop/package.json b/packages/hoppscotch-desktop/package.json index af7fa210..ff395f33 100644 --- a/packages/hoppscotch-desktop/package.json +++ b/packages/hoppscotch-desktop/package.json @@ -16,7 +16,7 @@ "@fontsource-variable/material-symbols-rounded": "5.1.3", "@fontsource-variable/roboto-mono": "5.1.0", "@hoppscotch/kernel": "workspace:^", - "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce", + "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31", "@hoppscotch/ui": "0.2.1", "@tauri-apps/api": "2.1.1", "@tauri-apps/plugin-process": "2.2.0", diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/LICENSE.md b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/LICENSE.md index 24bfc7fe..2b0b5d59 100644 --- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/LICENSE.md +++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 - CuriousCorrelation +Copyright (c) 2025 - CuriousCorrelation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/README.md b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/README.md index 2b069f78..11fb364a 100644 --- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/README.md +++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/README.md @@ -100,6 +100,6 @@ Requirements: ## License -Code: (c) 2024 - CuriousCorrelation +Code: (c) 2025 - CuriousCorrelation MIT or MIT/Apache 2.0 where applicable. diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/lib.rs b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/lib.rs index 5bc6b2a8..06eef760 100644 --- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/lib.rs +++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2024 CuriousCorrelation +// Copyright 2025 CuriousCorrelation // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/manager.rs b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/manager.rs index 962da9bc..e7b99391 100644 --- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/manager.rs +++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/manager.rs @@ -153,26 +153,32 @@ impl StorageManager { StorageError::Io(e) })?; + // Convert both paths to the same format for comparison, Windows... + let normalized_storage = dunce::canonicalize(&storage_path).unwrap_or(storage_path.clone()); + // NOTE: There cannot be more than one user config storage disk, // although even if there is, defaulting to the first one we found // is as good of a guess as any. - let disk = disks.into_iter().find(|disk| { - // Convert both paths to the same format for comparison, Windows... - let normalized_storage = - dunce::canonicalize(&storage_path).unwrap_or(storage_path.clone()); - let normalized_disk = dunce::canonicalize(disk.mount_point()) - .unwrap_or_else(|_| disk.mount_point().to_path_buf()); + // Find the disk with the longest matching mount point + let disk = disks + .into_iter() + .filter_map(|disk| { + let normalized_disk = dunce::canonicalize(disk.mount_point()) + .unwrap_or_else(|_| disk.mount_point().to_path_buf()); - normalized_storage.starts_with(&normalized_disk) - }); - - let Some(disk) = disk else { - tracing::error!( - storage_path = %storage_path.display(), - "Fatal error, unable to resolve user config storage disk" - ); - return Err(StorageError::DiskNotFound); - }; + normalized_storage + .starts_with(&normalized_disk) + .then_some((disk, normalized_disk)) + }) + .max_by_key(|(_, normalized_disk)| normalized_disk.as_os_str().len()) + .map(|(disk, _)| disk) + .ok_or_else(|| { + tracing::error!( + storage_path = %storage_path.display(), + "Fatal error, unable to resolve user config storage disk" + ); + StorageError::DiskNotFound + })?; let available = disk.available_space(); diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.lock b/packages/hoppscotch-desktop/src-tauri/Cargo.lock index a68af1c2..d7434b69 100644 --- a/packages/hoppscotch-desktop/src-tauri/Cargo.lock +++ b/packages/hoppscotch-desktop/src-tauri/Cargo.lock @@ -5038,7 +5038,7 @@ dependencies = [ [[package]] name = "tauri-plugin-appload" version = "0.1.0" -source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=0308b55e82f7f01d878a7fdf0f597d1dc975f2ce#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce" +source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=1b52e49d881926135838cf6cfebdc1643a9bec31#1b52e49d881926135838cf6cfebdc1643a9bec31" dependencies = [ "base64 0.22.1", "blake3", diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.toml b/packages/hoppscotch-desktop/src-tauri/Cargo.toml index ad74f145..2f8bf99b 100644 --- a/packages/hoppscotch-desktop/src-tauri/Cargo.toml +++ b/packages/hoppscotch-desktop/src-tauri/Cargo.toml @@ -29,7 +29,7 @@ tauri-plugin-store = "2.2.0" tauri-plugin-dialog = "2.2.0" tauri-plugin-fs = "2.2.0" tauri-plugin-deep-link = "2.2.0" -tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "0308b55e82f7f01d878a7fdf0f597d1dc975f2ce" } +tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "1b52e49d881926135838cf6cfebdc1643a9bec31" } tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "0147ac1bb29d3b88d6652432a482bd86f0174506" } axum = "0.8.1" tower-http = { version = "0.6.2", features = ["cors"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97abc47f..6050d941 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -525,8 +525,8 @@ importers: specifier: workspace:^ version: link:../hoppscotch-kernel '@hoppscotch/plugin-appload': - specifier: github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce - version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce' + specifier: github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31 + version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31' '@hoppscotch/ui': specifier: 0.2.5 version: 0.2.5(eslint@8.57.0)(terser@5.39.2)(typescript@5.8.3)(vite@5.4.9(@types/node@22.15.19)(sass@1.79.5)(terser@5.39.2))(vue@3.5.12(typescript@5.8.3)) @@ -998,8 +998,8 @@ importers: specifier: workspace:^ version: link:../hoppscotch-kernel '@hoppscotch/plugin-appload': - specifier: github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce - version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce' + specifier: github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31 + version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31' '@hoppscotch/ui': specifier: 0.2.1 version: 0.2.1(eslint@9.27.0(jiti@2.4.2))(terser@5.39.2)(typescript@5.8.3)(vite@5.4.11(@types/node@22.15.19)(sass@1.80.3)(terser@5.39.2))(vue@3.5.12(typescript@5.8.3)) @@ -1838,8 +1838,8 @@ packages: graphql: optional: true - '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce': - resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce} + '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31': + resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31} version: 0.1.0 '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/0147ac1bb29d3b88d6652432a482bd86f0174506': @@ -14528,7 +14528,7 @@ snapshots: optionalDependencies: graphql: 16.11.0 - '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce': + '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31': dependencies: '@tauri-apps/api': 2.1.1