Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(sqlite): accept linux absolute paths over ssh on windows

zipg46584ff46e2d
diff --git a/crates/dbx-core/src/db/sqlite_worker.rs b/crates/dbx-core/src/db/sqlite_worker.rs
index 4c27d9a881..e74248f264 100644
--- a/crates/dbx-core/src/db/sqlite_worker.rs
+++ b/crates/dbx-core/src/db/sqlite_worker.rs
@@ -315,7 +315,7 @@ pub async fn connect_sqlite_worker(
if db_path.is_empty() {
return Err("Remote SQLite path is empty".to_string());
}
- if !Path::new(db_path).is_absolute() && !db_path.starts_with("~/") {
+ if !is_remote_linux_path_absolute_or_home_relative(db_path) {
return Err("Remote SQLite path must be an absolute path on the final SSH hop".to_string());
}
validate_remote_path(db_path)?;
@@ -744,6 +744,11 @@ fn validate_remote_path(path: &str) -> Result<(), String> {
Ok(())
}
+fn is_remote_linux_path_absolute_or_home_relative(path: &str) -> bool {
+ // The remote host is Linux even when the DBX Desktop client runs on Windows.
+ path.starts_with('/') || path.starts_with("~/")
+}
+
fn shell_quote(value: &str) -> String {
format!("'{}'", value.replace('\'', "'\\''"))
}
@@ -814,6 +819,14 @@ mod tests {
assert!(error.contains("File does not exist"), "{error}");
}
+ #[test]
+ fn remote_sqlite_path_uses_linux_semantics_on_every_desktop_platform() {
+ assert!(is_remote_linux_path_absolute_or_home_relative("/volume1/music/library.db"));
+ assert!(is_remote_linux_path_absolute_or_home_relative("~/data/library.db"));
+ assert!(!is_remote_linux_path_absolute_or_home_relative("volume1/music/library.db"));
+ assert!(!is_remote_linux_path_absolute_or_home_relative(r"C:\data\library.db"));
+ }
+
#[tokio::test]
async fn read_jsonl_line_stops_at_newline_and_enforces_size_cap() {
let mut reader = BufReader::new(&b"{\"id\":1}\nleftover"[..]);