fix(db): keep no folder holding ;, |, a backtick or ) in Journal lines (#478) #491
6 changed files with 92 additions and 23 deletions
|
|
@ -21,6 +21,7 @@
|
|||
- Import : les messages de « Créer un dossier d'exemple » suivent désormais la langue de l'application : un dossier d'exemple déjà présent dans le dossier d'import (nommé, avec la marche à suivre : actualiser la liste, ou le renommer s'il n'y apparaît pas), un dossier d'import introuvable, une date du jour illisible. Toute autre erreur reste affichée telle que le système l'a écrite. Une fois les dossiers d'exemple écrits, le message de réussite ne s'affiche que si le dossier d'import a pu être relu ; sinon le message d'erreur s'affiche seul, au lieu des deux à la fois (#384).
|
||||
- Import : après le choix d'un autre dossier d'import, l'avertissement des fichiers posés directement dans le dossier d'import ne nomme plus les fichiers de l'ancien dossier sous le nom du nouveau, pendant la lecture du nouveau dossier ou quand il ne peut pas être lu (#446).
|
||||
- Import : un message d'erreur ne reste plus affiché une fois le dossier d'import relu, après « Actualiser » ou après le choix d'un autre dossier par « Parcourir » ; le message d'un dossier d'exemple déjà présent dans le dossier d'import demandait justement d'actualiser. Annuler le choix du dossier garde le message (#384).
|
||||
- Journaux (Paramètres → Système) : une ligne d'erreur sur l'ouverture ou la fermeture d'un profil ne garde plus le nom d'un dossier qui contient `;`, `|`, une apostrophe inverse ou une parenthèse fermante suivie d'un mot, comme `Jean (Work) Smith` : elle ne nomme que le fichier. La ligne écrite quand la réparation des migrations d'un profil échoue à son ouverture (« Migration repair failed ») ne nomme plus, elle aussi, que le fichier de la base ; elle en montrait le chemin complet, dossiers de votre compte compris. Ces lignes peuvent partir avec une rétroaction quand vous y incluez les derniers logs d'erreur. En contrepartie, le texte qui suit un chemin après l'un de ces caractères et qui contient un `/` ou un `\` est désormais retiré avec les dossiers, jusqu'à son dernier `/` ou `\` (#478).
|
||||
|
||||
### Sécurité
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
- Import: the messages of “Create a sample folder” now follow the app's language: a sample folder already in the import folder (named, with what to do: refresh the list, or rename it if it does not show up), an import folder that cannot be found, today's date unreadable. Any other error still shows as the system wrote it. Once the sample folders are written, the success message only shows when the import folder could be read again; otherwise the error message shows alone, instead of both at once (#384).
|
||||
- Import: after you choose another import folder, the warning about the files placed directly in the import folder no longer names the previous folder's files under the new folder's name, while the new folder is being read or when it cannot be read (#446).
|
||||
- Import: an error message no longer stays on screen once the import folder is read again, after “Refresh” or after choosing another folder with “Browse”; the message of a sample folder already in the import folder asked for that very refresh. Cancelling the folder choice keeps the message (#384).
|
||||
- Logs (Settings → System): an error line about opening or closing a profile no longer keeps the name of a folder that holds `;`, `|`, a backtick or a closing parenthesis followed by a word, such as `Jean (Work) Smith`: it names the file only. The line written when the migration repair of a profile fails at opening (“Migration repair failed”) now names the database file only too; it showed the file's full path, folders of your user account included. These lines can go with a feedback report when you include the recent error logs. In return, text that follows a path after one of these characters and holds a `/` or a `\` is now dropped with the folders, up to its last `/` or `\` (#478).
|
||||
|
||||
### Security
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ Comme sqlx pour le profil par défaut. Une version qui échoue sur une clé étr
|
|||
|
||||
### 7. L'échec reste ouvert
|
||||
|
||||
Un rattrapage interrompu est écrit au Journal et le profil s'ouvre comme avant #390. Les messages nomment des fichiers, jamais le dossier : il contient le nom d'utilisateur du système, et une ligne d'erreur du Journal peut être jointe à une rétroaction (Loi 25). Un rattrapage qui s'arrête après sa copie la nomme quand même : `catch_up_backup` (nom de fichier seul) est rempli dès que la copie existe, et la ligne d'erreur du Journal finit par « copy of the previous state kept as … » (#395). Côté TypeScript, `withoutFolders` réduit chaque chemin d'une ligne d'erreur, message de repli compris, à son dernier segment (le nom de fichier). Un chemin part d'un début reconnu (lecteur `C:\`, `/`, `~/`, `./`, partage `\\`, ou le `<profile folder>` de `scrub`) et court jusqu'à son dernier séparateur, espaces compris, pour qu'un dossier comme `C:\Users\Jean Dupont\` ou `/home/marie claire/` ne laisse aucun mot derrière lui ; il s'arrête à un saut de ligne, un guillemet double, une apostrophe inverse, `;`, `|`, une virgule ou un deux-points suivis d'un blanc, une parenthèse fermante qui n'est pas suivie d'un séparateur (`Program Files (x86)\` continue), ou un blanc suivi d'un autre chemin. Une apostrophe placée juste avant le chemin reste autour du nom de fichier (`'C:\Users\Bob\x.db'` donne `'x.db'`). Quand rien ne l'arrête, la règle est prudente : elle retire le texte qui suit jusqu'au dernier séparateur de la ligne plutôt que de laisser passer un dossier. Deux limites (précisées par #437). Un chemin relatif sans début reconnu garde l'ancien repli, d'un blanc à l'autre : un morceau qui porte deux séparateurs ou plus est réduit à son dernier segment (`dossier/sous/x.db` donne `x.db`), un morceau qui n'en porte qu'un voit son séparateur remplacé par `-`, si bien que les mots d'un dossier qui contient un blanc restent (`dossier/sous dossier/x.db` donne `dossier-sous dossier-x.db`) ; un tel chemin ne part pas du dossier personnel, donc n'en contient pas le nom. Et un nom de dossier qui contient l'un des arrêts (une apostrophe inverse, `;`, `|`, une parenthèse fermante suivie d'autre chose qu'un séparateur…) arrête le chemin là : ce nom, ou son début, reste dans la ligne, et ce peut être un nom d'utilisateur (`C:\Users\Jean (Work) Smith\AppData\x.db` donne `Jean (Work) x.db`). Tout autre séparateur devient `-` : aucune ligne d'erreur ne contient `/` ni `\`.
|
||||
Un rattrapage interrompu est écrit au Journal et le profil s'ouvre comme avant #390. Les messages nomment des fichiers, jamais le dossier : il contient le nom d'utilisateur du système, et une ligne d'erreur du Journal peut être jointe à une rétroaction (Loi 25). Un rattrapage qui s'arrête après sa copie la nomme quand même : `catch_up_backup` (nom de fichier seul) est rempli dès que la copie existe, et la ligne d'erreur du Journal finit par « copy of the previous state kept as … » (#395). Côté TypeScript, `withoutFolders` réduit chaque chemin d'une ligne d'erreur, message de repli compris, à son dernier segment (le nom de fichier) ; depuis #478, la ligne d'un échec de `repair_migrations`, où rusqlite écrit le chemin complet de la base, y passe aussi. Un chemin part d'un début reconnu (lecteur `C:\`, `/`, `~/`, `./`, partage `\\`, ou le `<profile folder>` de `scrub`) et court jusqu'à son dernier séparateur, espaces compris, pour qu'un dossier comme `C:\Users\Jean Dupont\` ou `/home/marie claire/` ne laisse aucun mot derrière lui ; il s'arrête à un saut de ligne, un guillemet double, une virgule ou un deux-points suivis d'un blanc, ou un blanc suivi d'un autre chemin. Un nom de dossier peut contenir une apostrophe inverse, `;`, `|` ou une parenthèse fermante suivie d'un mot (`C:\Users\Jean (Work) Smith\`) : aucun de ces caractères n'arrête le chemin (#478, décision de Max du 2026-10-20). Une apostrophe placée juste avant le chemin reste autour du nom de fichier (`'C:\Users\Bob\x.db'` donne `'x.db'`). Quand rien ne l'arrête, la règle est prudente : elle retire le texte qui suit jusqu'au dernier séparateur de la ligne plutôt que de laisser passer un dossier. C'est le coût d'arrêts aussi rares : un texte qui suit le chemin et porte un séparateur disparaît avec lui (`/a/x.db; I/O` donne `O`, `(see /a/x.db) and I/O` donne `(see O`), alors que `unable to open /a/x.db: disk I/O error` garde son suffixe, le chemin s'arrêtant au deux-points suivi d'un blanc (`unable to open x.db: disk I-O error`). Deux limites (précisées par #437, la seconde réduite par #478). Un chemin relatif sans début reconnu garde l'ancien repli, d'un blanc à l'autre : un morceau qui porte deux séparateurs ou plus est réduit à son dernier segment (`dossier/sous/x.db` donne `x.db`), un morceau qui n'en porte qu'un voit son séparateur remplacé par `-`, si bien que les mots d'un dossier qui contient un blanc restent (`dossier/sous dossier/x.db` donne `dossier-sous dossier-x.db`) ; un tel chemin ne part pas du dossier personnel, donc n'en contient pas le nom. Et un nom de dossier qui contient l'un des arrêts ci-dessus arrête le chemin là : ce nom, ou son début, reste dans la ligne (`C:\Users\jean\Smith, Jean\x.db` donne `Smith, Jean-x.db`), et parfois les dossiers qui le suivent. La suite est en effet relue comme du texte : un séparateur précédé d'une virgule, d'une apostrophe, d'un `=`, d'un `[` ou du deux-points d'un lecteur ouvre un nouveau chemin, et le repli garde les mots d'un morceau qui ne porte plus qu'un séparateur (`C:\Users\jean\Smith, Jean\Notes,\x.db` donne `Smith, Jean-Notes,x.db`, avant comme après #478). Sans arrêts mous, ce nouveau chemin court plus loin et peut consommer les séparateurs dont le repli avait besoin : #478 ajoute ainsi de rares cas où un mot reste là où l'ancien code le retirait (`C:\Users\jean\Smith, Jean\Notes,\Old;Copy\x.db` donnait `Smith, x.db` et donne `Smith, Jean-Notes,x.db`). Mesure de la revue de la PR #491, sur 300 000 lignes aléatoires : aucune fuite parmi les 179 310 lignes dont aucun nom de dossier ne contient un arrêt conservé (74 609 avant #478) ; parmi les autres, 107 gardent un mot que l'ancien code retirait, dont 6 qui ne laissaient rien passer avant. Toutes les erreurs de `prepare_at` passent d'abord par `scrub` côté Rust, et `withoutFolders` n'y est que le second rideau ; celles de `repair_migrations` n'ont que lui. Sous Windows, un nom de dossier ne peut contenir ni guillemet double, ni deux-points, ni saut de ligne, et un nom de compte pas de virgule : le dossier personnel n'y est donc plus concerné que par un blanc suivi d'un début de chemin (`C:\Users\Jean ~\AppData\x.db` donne `Jean x.db`), alors qu'il l'était aussi par une parenthèse suivie d'un mot (`C:\Users\Jean (Work) Smith\AppData\x.db` donnait `Jean (Work) x.db` et donne désormais `x.db`) et par une apostrophe inverse, qu'un nom de compte peut contenir (``C:\Users\O`Brien\x.db`` donnait ``O`Brien-x.db`` et donne désormais `x.db`). Tout autre séparateur devient `-` : aucune ligne d'erreur ne contient `/` ni `\`.
|
||||
|
||||
### 8. Un seul dossier des bases
|
||||
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ Garde : `src/__integration__/i18n-mock-guard.test.ts` lit tous les `*.test.ts(x)
|
|||
### Limites connues (#437)
|
||||
|
||||
- **Emplacements préréglés du harnais.** Le harnais donne un emplacement à chaque appel de hook, tous types confondus (`useState`, `useReducer`, `useRef`, `useMemo`, `useCallback`, `useEffect`), dans l'ordre des appels : c'est le helper `slot` de `fakeReact`. Un test qui prérègle un emplacement par sa position (`harness.slots[0] = …`) dépend donc de l'ordre des hooks du composant : un hook ajouté avant, de n'importe quel type, décale les emplacements sans rien dire, et la valeur préréglée tombe sur un autre hook. Préréglages actuels, chacun commenté dans son fichier : `PriceFetchConsentToggle.test.tsx` (emplacements 0 à 2), `PriceFetchControl.test.tsx` (la fenêtre de consentement ouverte), `useOnboardingChecklist.wiring.test.ts` (`mountWith` et deux écritures directes) et `SystemsSettingsPage.test.tsx` ; `OnboardingStepCard.test.tsx` lit le `useRef` de l'emplacement 0. Qui ajoute un hook avant ces emplacements met le test à jour. Un test qui ouvre un état par un clic dans l'arbre rendu (`TransactionTable.wiring.test.ts`) n'a pas cette dépendance.
|
||||
- **`withoutFolders`.** Ses arrêts et ses deux limites (chemin relatif sans début reconnu ; nom de dossier qui contient l'un des arrêts) sont dans l'[ADR 0021](adr/0021-migrations-profils-secondaires.md), § 7.
|
||||
- **`withoutFolders`.** Ses arrêts, le coût de sa règle prudente (un texte qui suit un chemin et porte un séparateur disparaît avec lui : `/a/x.db; I/O` donne `O`, sauf derrière une virgule ou un deux-points suivis d'un blanc, qui arrêtent le chemin : `unable to open /a/x.db: disk I/O error` garde son suffixe) et ses deux limites sont dans l'[ADR 0021](adr/0021-migrations-profils-secondaires.md), § 7. La première, un chemin relatif sans début reconnu, reste entière. La seconde, un nom de dossier qui contient l'un des arrêts, est réduite par #478 : une apostrophe inverse, `;`, `|` et une parenthèse fermante n'arrêtent plus rien, et parmi les arrêts qui restent, seul un blanc suivi d'un début de chemin peut figurer dans le dossier personnel sous Windows. Un arrêt qui reste laisse le nom de ce dossier, ou son début, et parfois les dossiers qui le suivent (`…\Smith, Jean\Notes,\x.db` donne `Smith, Jean-Notes,x.db`) ; #478 en ajoute de rares cas, mesurés dans l'ADR.
|
||||
- **Mesure du rattrapage.** Le test `#[ignore]` `a_large_profile_catch_up_duration` (`profile_db.rs`) ne tourne pas en CI et n'asserte rien sur la durée : il vérifie que le rattrapage aboutit (aucune erreur, plancher 6), puis imprime la durée. Sa mesure, prise sur un SSD NVMe, et le risque qu'elle ne couvre pas (disque lent, antivirus qui inspecte la copie) sont dans l'[ADR 0021](adr/0021-migrations-profils-secondaires.md), « Négatives et points de vigilance », point « Le délai de démarrage couvre le rattrapage du profil actif ».
|
||||
|
||||
## CI/CD
|
||||
|
|
|
|||
|
|
@ -598,6 +598,22 @@ describe("a profile is prepared before the plugin opens it (#390)", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("writes no folder when the checksum repair fails with a path (#478)", async () => {
|
||||
// rusqlite appends the full path of a database it cannot open, and
|
||||
// repair_migrations returns that message as it is.
|
||||
vi.mocked(invoke).mockImplementationOnce(async () => {
|
||||
throw "Cannot open database: unable to open database file: C:\\Users\\Jean (Work) Smith\\AppData\\Roaming\\com.simpl.resultat\\profile_0a1b2c3d.db";
|
||||
});
|
||||
|
||||
await connectToProfile("profile_0a1b2c3d.db");
|
||||
|
||||
expect(vi.mocked(invoke).mock.calls[0][0]).toBe("repair_migrations");
|
||||
expect(Database.load).toHaveBeenCalledWith("sqlite:profile_0a1b2c3d.db");
|
||||
expect(vi.mocked(logError).mock.calls.map((call) => call[0])).toEqual([
|
||||
"Migration repair failed: Cannot open database: unable to open database file: profile_0a1b2c3d.db",
|
||||
]);
|
||||
});
|
||||
|
||||
it("names the copy in the Journal when the catch-up stopped after taking it (#395)", async () => {
|
||||
h.prepare = async () =>
|
||||
report({
|
||||
|
|
@ -700,6 +716,21 @@ describe("describePreparation (#390)", () => {
|
|||
}
|
||||
});
|
||||
|
||||
it("writes no folder that holds a `)` followed by a word or a `;` in an error line (#478)", () => {
|
||||
const lines = describePreparation(
|
||||
"x.db",
|
||||
report({
|
||||
// A path scrub did not replace, under a user folder `Jean (Work) Smith`.
|
||||
catch_up_error:
|
||||
"backup_failed: unable to open database: C:\\Users\\Jean (Work) Smith\\AppData\\Roaming\\com.simpl.resultat\\migration-backups\\x-before-v17.db.tmp",
|
||||
catch_up_backup: "C:\\Users\\jean\\My;Docs\\x-before-v17.db",
|
||||
})
|
||||
);
|
||||
expect(lines.errors).toEqual([
|
||||
"Profile x.db: database update stopped: backup_failed: unable to open database: x-before-v17.db.tmp; copy of the previous state kept as x-before-v17.db",
|
||||
]);
|
||||
});
|
||||
|
||||
it("withoutFolders keeps text without a path as is", () => {
|
||||
expect(withoutFolders("migration_failed:v12: near \"x\": syntax error")).toBe(
|
||||
'migration_failed:v12: near "x": syntax error'
|
||||
|
|
@ -718,7 +749,8 @@ describe("describePreparation (#390)", () => {
|
|||
["\\\\server\\share\\Jean Dupont\\x.db", "x.db"],
|
||||
["C:\\Program Files (x86)\\Simpl\\x.db", "x.db"],
|
||||
['"C:\\Users\\Jean Dupont\\x.db" failed', '"x.db" failed'],
|
||||
["(see /home/marie claire/x.db) and I/O", "(see x.db) and I-O"],
|
||||
// A `)` no longer ends a path: the cut goes to the `/` of `I/O` (#478).
|
||||
["(see /home/marie claire/x.db) and I/O", "(see O"],
|
||||
["path=/home/marie claire/x.db;next", "path=x.db;next"],
|
||||
])("withoutFolders reduces %s to its last segment", (input, expected) => {
|
||||
const cleaned = withoutFolders(input);
|
||||
|
|
@ -726,6 +758,21 @@ describe("describePreparation (#390)", () => {
|
|||
expect(cleaned).not.toMatch(/Jean|Dupont|marie|claire|Users|home|Program|server/);
|
||||
});
|
||||
|
||||
// A folder name may hold `;`, `|`, a backtick, or a `)` followed by a word:
|
||||
// none of them ends a path, so no word of that folder stays (#478).
|
||||
it.each([
|
||||
["C:\\Users\\Jean (Work) Smith\\AppData\\x.db", "x.db"],
|
||||
["C:\\Users\\jean\\My;Docs\\x.db", "x.db"],
|
||||
["C:\\Users\\jean\\My|Docs\\x.db", "x.db"],
|
||||
["C:\\Users\\jean\\My`Docs\\x.db", "x.db"],
|
||||
["unable to open C:\\Users\\Jean (Work) Smith\\AppData\\x.db: disk I/O error", "unable to open x.db: disk I-O error"],
|
||||
["/home/jean (work)/x.db", "x.db"],
|
||||
])("withoutFolders keeps no word of a folder that holds a former stop: %s (#478)", (input, expected) => {
|
||||
const cleaned = withoutFolders(input);
|
||||
expect(cleaned).toBe(expected);
|
||||
expect(cleaned).not.toMatch(/Users|Jean|jean|Work|work|Smith|AppData|My|Docs|home/);
|
||||
});
|
||||
|
||||
it("withoutFolders ends a path at sentence punctuation and at the next path", () => {
|
||||
expect(withoutFolders("unable to open /home/marie claire/x.db: disk I/O error")).toBe(
|
||||
"unable to open x.db: disk I-O error"
|
||||
|
|
@ -736,7 +783,13 @@ describe("describePreparation (#390)", () => {
|
|||
expect(withoutFolders("'C:\\a\\b.db' and 'C:\\Users\\Jean Dupont\\d.db'")).toBe("'b.db' and 'd.db'");
|
||||
});
|
||||
|
||||
it.each([["\""], [";"], ["|"], ["`"], ["\n"], ["\r"]])("withoutFolders ends the folders at %j", (stop) => {
|
||||
it("withoutFolders still ends a path at the next path past a `)` (#478)", () => {
|
||||
expect(withoutFolders("(see /home/marie claire/a.db) and C:\\Users\\Jean Dupont\\b.db")).toBe(
|
||||
"(see a.db) and b.db"
|
||||
);
|
||||
});
|
||||
|
||||
it.each([["\""], ["\n"], ["\r"]])("withoutFolders ends the folders at %j", (stop) => {
|
||||
expect(withoutFolders(`/home/marie claire/x.db${stop} I/O`)).toBe(`x.db${stop} I-O`);
|
||||
});
|
||||
|
||||
|
|
@ -745,8 +798,13 @@ describe("describePreparation (#390)", () => {
|
|||
expect(withoutFolders("cannot open '/home/marie claire/x.db' now")).toBe("cannot open 'x.db' now");
|
||||
});
|
||||
|
||||
it("withoutFolders drops more text rather than a folder when nothing ends the path", () => {
|
||||
// Conservative: everything up to the last separator of the line goes.
|
||||
expect(withoutFolders("/home/marie claire/x.db then I/O")).toBe("O");
|
||||
});
|
||||
// Conservative: everything up to the last separator of the line goes. `;`,
|
||||
// `|`, a backtick and `)` may sit in a folder name, so they end nothing
|
||||
// either, and a suffix after them that holds a separator goes too (#478).
|
||||
it.each([[" then"], [";"], ["|"], ["`"], [")"]])(
|
||||
"withoutFolders drops more text rather than a folder when nothing ends the path, after %j",
|
||||
(after) => {
|
||||
expect(withoutFolders(`/home/marie claire/x.db${after} I/O`)).toBe("O");
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -328,8 +328,12 @@ export interface ProfilePreparation {
|
|||
*/
|
||||
const PATH_START = /<profile folder>[\\/]|[A-Za-z]:[\\/]|~[\\/]|\.{1,2}[\\/]|[\\/]/y;
|
||||
const BEFORE_START = /[\s'"`(=:,[]/;
|
||||
/** What ends the folders of a path for sure: a line break, a double quote or a backtick, `;`, `|`. */
|
||||
const PATH_STOP = /[\n\r"`;|]/;
|
||||
/**
|
||||
* What ends the folders of a path for sure: a line break or a double quote,
|
||||
* both forbidden in a Windows name. A backtick, `;` and `|` can sit in a
|
||||
* folder name, so they end nothing (#478).
|
||||
*/
|
||||
const PATH_STOP = /[\n\r"]/;
|
||||
/** The last segment of a path: the file name, kept. */
|
||||
const LAST_SEGMENT = /[^\s"`()<>\\/]*/y;
|
||||
/**
|
||||
|
|
@ -367,8 +371,8 @@ function lastSeparator(text: string, from: number): number {
|
|||
if (PATH_STOP.test(c)) break;
|
||||
// Sentence punctuation: Windows forbids `:` in a name, and no user name holds `,`.
|
||||
if ((c === "," || c === ":") && (next === "" || /\s/.test(next))) break;
|
||||
// `Program Files (x86)\…` goes on; `(see /x/y.db) and…` stops.
|
||||
if (c === ")" && next !== "\\" && next !== "/") break;
|
||||
// No `)` stop: `Jean (Work) Smith\…` is a folder name as much as
|
||||
// `Program Files (x86)\…` (#478).
|
||||
if (/\s/.test(c) && newPathAfter(text, k)) break;
|
||||
}
|
||||
return last;
|
||||
|
|
@ -378,16 +382,18 @@ function lastSeparator(text: string, from: number): number {
|
|||
* Keep only the last segment of every path in `text`: error lines can be
|
||||
* attached to a feedback report, and a folder holds the OS user name
|
||||
* (Loi 25). A folder may contain blanks (`C:\Users\Jean Dupont\…`,
|
||||
* `/home/marie claire/…`): from its start, a path runs to its LAST separator
|
||||
* before a line break, a double quote, a backtick, `;`, `|`, a `,` or `:`
|
||||
* followed by a blank, a closing parenthesis not followed by a separator, or a
|
||||
* blank followed by another path. When nothing ends it, the rule is
|
||||
* conservative: text after a path is dropped up to the last separator of the
|
||||
* line (`/a/x.db then I/O` gives `O`), rather than letting a folder through.
|
||||
* Limits in ADR 0021, section 7. A quote right before the path is
|
||||
* not part of it, so both quotes stay around the file name
|
||||
* (`'C:\Users\Bob\x.db'` gives `'x.db'`). Any other separator becomes `-` (SQLite's "disk I/O error" reads
|
||||
* "disk I-O error"), so an error line never contains a `/` nor a `\` (#395).
|
||||
* `/home/marie claire/…`), a backtick, `;`, `|` or a `)` followed by a word
|
||||
* (`C:\Users\Jean (Work) Smith\…`, #478): from its start, a path runs to its
|
||||
* LAST separator before a line break, a double quote, a `,` or `:` followed
|
||||
* by a blank, or a blank followed by another path. When nothing ends it, the
|
||||
* rule is conservative: text after a path is dropped up to the last separator
|
||||
* of the line, rather than letting a folder through. With so few stops, that
|
||||
* costs a readable suffix: `/a/x.db then I/O` and `/a/x.db; I/O` give `O`,
|
||||
* `(see /a/x.db) and I/O` gives `(see O`. Limits in ADR 0021, section 7. A
|
||||
* quote right before the path is not part of it, so both quotes stay around
|
||||
* the file name (`'C:\Users\Bob\x.db'` gives `'x.db'`). Any other separator
|
||||
* becomes `-` (SQLite's "disk I/O error" reads "disk I-O error"), so an error
|
||||
* line never contains a `/` nor a `\` (#395).
|
||||
*/
|
||||
export function withoutFolders(text: string): string {
|
||||
let out = "";
|
||||
|
|
@ -469,7 +475,10 @@ export function connectToProfile(dbFilename: string): Promise<void> {
|
|||
console.warn("Migration checksums repaired for", dbFilename);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Migration repair failed:", e);
|
||||
// repair_migrations returns rusqlite's error unscrubbed, and rusqlite
|
||||
// appends the full path of a database it cannot open: only the file
|
||||
// name may reach the Journal (#478).
|
||||
logError(withoutFolders(`Migration repair failed: ${e instanceof Error ? e.message : String(e)}`));
|
||||
}
|
||||
// Catch a secondary profile up on the migrations tauri-plugin-sql never
|
||||
// runs for it, and repair legacy values in every profile (#390). Fails
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue