amalgm 0.1.113 → 0.1.114
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
CHANGED
|
@@ -267,7 +267,18 @@ async function searchRoot(resolveSafePath, root, query, deadline, maxEntries) {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
function normalizeSearchRoots(value) {
|
|
270
|
-
|
|
270
|
+
let rawRoots = value;
|
|
271
|
+
if (typeof rawRoots === 'string') {
|
|
272
|
+
const trimmed = rawRoots.trim();
|
|
273
|
+
if (trimmed.startsWith('[')) {
|
|
274
|
+
try {
|
|
275
|
+
rawRoots = JSON.parse(trimmed);
|
|
276
|
+
} catch {
|
|
277
|
+
rawRoots = trimmed;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const roots = Array.isArray(rawRoots) ? rawRoots : [rawRoots];
|
|
271
282
|
return Array.from(new Set(
|
|
272
283
|
roots
|
|
273
284
|
.map((root) => (typeof root === 'string' ? root.trim() : ''))
|
|
@@ -11,6 +11,10 @@ async function handleFileRoutes(ctx) {
|
|
|
11
11
|
fsRest.handleRead(ctx.getQuery(), ctx.sendJson);
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
|
+
if (ctx.pathname === '/fs/search' && ctx.method === 'GET') {
|
|
15
|
+
fsRest.handleSearch(ctx.getQuery(), ctx.sendJson);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
14
18
|
if (ctx.pathname === '/fs/search' && ctx.method === 'POST') {
|
|
15
19
|
fsRest.handleSearch(await ctx.readJsonBody(), ctx.sendJson);
|
|
16
20
|
return true;
|