feat(locate-db): skip indexing directories with remote source configuration
This commit is contained in:
parent
a1b2fa5ea7
commit
ba8de6634e
|
|
@ -196,6 +196,24 @@ export async function buildLocateDb(
|
|||
prevBytes = bytes;
|
||||
onProgress?.('scanning', totalBytes, dir);
|
||||
}, 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) {
|
||||
entries.push(e);
|
||||
if (e.type === 'folder') queue.push(e.path);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user