diff --git a/packages/app-tests/externalSqlFileStartup.test.ts b/packages/app-tests/externalSqlFileStartup.test.ts index 7d28460fe0..2f400fa88f 100644 --- a/packages/app-tests/externalSqlFileStartup.test.ts +++ b/packages/app-tests/externalSqlFileStartup.test.ts @@ -128,7 +128,7 @@ test("cold-start SQL files wait for restored tabs before opening", () => { const openPathSource = appSource.slice(openPathStart, openPathEnd); const initializationWait = openPathSource.indexOf("await desktopOpenTabsRestorationBarrier?.settled"); - const fileRead = openPathSource.indexOf("api.readExternalSqlFileSnapshot(path)"); + const fileRead = openPathSource.indexOf("api.readExternalSqlFileSnapshot(path, externalSqlEditorMaxBytes(settingsStore.editorSettings.externalSqlEditorMaxMb))"); const tabOpen = openPathSource.indexOf("queryStore.openExternalSqlFile"); assert.ok(initializationWait >= 0); assert.ok(initializationWait < fileRead); diff --git a/packages/app-tests/sqlLibraryImportEncoding.test.ts b/packages/app-tests/sqlLibraryImportEncoding.test.ts index feab0df519..2cba3161fa 100644 --- a/packages/app-tests/sqlLibraryImportEncoding.test.ts +++ b/packages/app-tests/sqlLibraryImportEncoding.test.ts @@ -9,7 +9,7 @@ test("SQL library imports use the charset-aware external SQL reader", () => { const end = source.indexOf("async function chooseSyncDirectory", start); const handler = start >= 0 && end > start ? source.slice(start, end) : ""; - assert.match(handler, /await api\.readExternalSqlFile\(path\)/); + assert.match(handler, /await api\.readExternalSqlFile\(path, externalSqlEditorMaxBytes\(settingsStore\.editorSettings\.externalSqlEditorMaxMb\)\)/); assert.doesNotMatch(handler, /readTextFile/); }); diff --git a/src-tauri/src/commands/external_sql.rs b/src-tauri/src/commands/external_sql.rs index 6bce7c4362..7e479f1172 100644 --- a/src-tauri/src/commands/external_sql.rs +++ b/src-tauri/src/commands/external_sql.rs @@ -8,7 +8,7 @@ use sha2::{Digest, Sha256}; use tokio::io::AsyncReadExt; const MAX_EXTERNAL_SQL_EDITOR_FILE_BYTES: u64 = 64 * 1024 * 1024; -const MIN_EXTERNAL_SQL_EDITOR_FILE_BYTES: u64 = 1 * 1024 * 1024; +const MIN_EXTERNAL_SQL_EDITOR_FILE_BYTES: u64 = 1024 * 1024; const MAX_EXTERNAL_SQL_EDITOR_FILE_BYTES_LIMIT: u64 = 4096 * 1024 * 1024; fn clamp_external_sql_editor_limit(max_size_bytes: Option) -> u64 {