fix: Double recursive loops can cause server lockup on deeply nested docs (#5222)
This commit is contained in:
@@ -6,6 +6,7 @@ import parseAttachmentIds from "./parseAttachmentIds";
|
||||
it("should return an empty array with no matches", () => {
|
||||
expect(parseAttachmentIds(`some random text`).length).toBe(0);
|
||||
});
|
||||
|
||||
it("should not return orphaned UUID's", () => {
|
||||
const uuid = uuidv4();
|
||||
expect(
|
||||
@@ -14,6 +15,7 @@ it("should not return orphaned UUID's", () => {
|
||||
`).length
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
it("should parse attachment ID from markdown", () => {
|
||||
const uuid = uuidv4();
|
||||
const results = parseAttachmentIds(
|
||||
@@ -22,6 +24,7 @@ it("should parse attachment ID from markdown", () => {
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0]).toBe(uuid);
|
||||
});
|
||||
|
||||
it("should parse attachment ID from markdown with additional query params", () => {
|
||||
const uuid = uuidv4();
|
||||
const results = parseAttachmentIds(
|
||||
@@ -30,6 +33,7 @@ it("should parse attachment ID from markdown with additional query params", () =
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0]).toBe(uuid);
|
||||
});
|
||||
|
||||
it("should parse attachment ID from markdown with fully qualified url", () => {
|
||||
const uuid = uuidv4();
|
||||
const results = parseAttachmentIds(
|
||||
@@ -38,6 +42,7 @@ it("should parse attachment ID from markdown with fully qualified url", () => {
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0]).toBe(uuid);
|
||||
});
|
||||
|
||||
it("should parse attachment ID from markdown with title", () => {
|
||||
const uuid = uuidv4();
|
||||
const results = parseAttachmentIds(
|
||||
@@ -46,6 +51,7 @@ it("should parse attachment ID from markdown with title", () => {
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0]).toBe(uuid);
|
||||
});
|
||||
|
||||
it("should parse multiple attachment IDs from markdown", () => {
|
||||
const uuid = uuidv4();
|
||||
const uuid2 = uuidv4();
|
||||
@@ -58,6 +64,7 @@ some text
|
||||
expect(results[0]).toBe(uuid);
|
||||
expect(results[1]).toBe(uuid2);
|
||||
});
|
||||
|
||||
it("should parse attachment ID from html", () => {
|
||||
const uuid = uuidv4();
|
||||
const results = parseAttachmentIds(
|
||||
@@ -66,6 +73,7 @@ it("should parse attachment ID from html", () => {
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0]).toBe(uuid);
|
||||
});
|
||||
|
||||
it("should parse attachment ID from html with fully qualified url", () => {
|
||||
const uuid = uuidv4();
|
||||
const results = parseAttachmentIds(
|
||||
|
||||
Reference in New Issue
Block a user