feat(locate-db): skip indexing directories with remote source configuration

This commit is contained in:
Jaime Idolpx 2026-06-17 14:06:21 -04:00
parent a1b2fa5ea7
commit ba8de6634e

View File

@ -196,6 +196,24 @@ export async function buildLocateDb(
prevBytes = bytes; prevBytes = bytes;
onProgress?.('scanning', totalBytes, dir); onProgress?.('scanning', totalBytes, dir);
}, signal); }, signal);
// If this directory has a .config with a URL-scheme base_url it points to
// a remote source — skip indexing its contents entirely.
const configEntry = batch.find(e => e.type === 'file' && basename(e.path) === '.config');
if (configEntry) {
try {
const res = await fetch(getWebDAVBaseUrl() + configEntry.path, { signal });
if (res.ok) {
const text = await res.text();
const m = text.match(/^base_url\s*:\s*(.+)$/m);
if (m) {
const val = m[1].trim().replace(/^['"]|['"]$/g, '');
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(val)) continue;
}
}
} catch { /* non-fatal — proceed normally */ }
}
for (const e of batch) { for (const e of batch) {
entries.push(e); entries.push(e);
if (e.type === 'folder') queue.push(e.path); if (e.type === 'folder') queue.push(e.path);