Merge remote-tracking branch 'origin/farm/6449817e/package-omp-docs'

This commit is contained in:
can1357
2026-06-05 11:44:34 +02:00
5 changed files with 47 additions and 3 deletions
@@ -64,9 +64,15 @@ export class OmpProtocolHandler implements ProtocolHandler {
throw new Error("Path traversal (..) is not allowed in omp:// URLs");
}
const content = EMBEDDED_DOCS[normalized];
const docPath =
normalized === "docs" ? "" : normalized.startsWith("docs/") ? normalized.slice("docs/".length) : normalized;
if (!docPath) {
return this.#listDocs(url);
}
const content = EMBEDDED_DOCS[docPath];
if (content === undefined) {
const lookup = normalized.replace(/\.md$/, "");
const lookup = docPath.replace(/\.md$/, "");
const suggestions = EMBEDDED_DOC_FILENAMES.filter(
f => f.includes(lookup) || lookup.includes(f.replace(/\.md$/, "")),
).slice(0, 5);
+1 -1
View File
@@ -259,7 +259,7 @@ interface IndexedContentLines {
}
const INTERNAL_URL_DISPLAY_RE = /^[a-z][a-z0-9+.-]*:\/\//i;
const OMP_ROOT_URL_RE = /^omp:\/\/\/?$/i;
const OMP_ROOT_URL_RE = /^omp:\/\/(?:\/?|docs\/?)$/i;
function normalizeSearchLine(line: string): string {
return line.endsWith("\r") ? line.slice(0, -1) : line;