@makimoto/cc-log-viewer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server.js +10 -4
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -22,14 +22,20 @@ function sanitizeFtsQuery(q) {
|
|
|
22
22
|
if (!terms.length || (terms.length === 1 && terms[0] === "")) {
|
|
23
23
|
return '""';
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const cleaned = [];
|
|
26
26
|
for (const term of terms) {
|
|
27
|
-
|
|
27
|
+
// Strip FTS5 special chars
|
|
28
|
+
const clean = term.replace(/["\x00*(){}^~:]/g, "");
|
|
28
29
|
if (clean) {
|
|
29
|
-
|
|
30
|
+
cleaned.push(clean);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
if (!cleaned.length) return '""';
|
|
34
|
+
// Quote all terms except the last; last term uses prefix matching (*)
|
|
35
|
+
const parts = cleaned.slice(0, -1).map((t) => `"${t}"`);
|
|
36
|
+
const last = cleaned[cleaned.length - 1];
|
|
37
|
+
parts.push(`"${last}"*`);
|
|
38
|
+
return parts.join(" ");
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
// SPA routing
|