Merge remote-tracking branch 'origin/farm/6449817e/package-omp-docs'
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user