| … | … | @@ -0,0 +1,98 @@ | |
| 90 | + | return line; | |
| 91 | + | } | |
| 92 | + | if (openFence !== null) return line; | |
| 93 | + | return line.replace(RELATIVE_UPLOAD_PATTERN, (match, _code, prefix: string | undefined) => | |
🟡 Medium src/gitlabMedia.ts:92
resolveGitLabUploadLinks rewrites upload destinations inside four-space-indented code blocks, so rendered and copied code samples no longer match the original comment. The fence check does not cover indented code; skip indented code lines before applying RELATIVE_UPLOAD_PATTERN.
| 1 | if (openFence !== null) return line; |
| 2 | - return line.replace(RELATIVE_UPLOAD_PATTERN, (match, _code, prefix: string | undefined) => |
| 3 | + if (/^(?: {4}|\t)/u.test(line)) return line; |
| 4 | + return line.replace(RELATIVE_UPLOAD_PATTERN, (match, _code, prefix: string | undefined) => |
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/shared/src/gitlabMedia.ts around lines 92-93: |
| 2 | |
| 3 | `resolveGitLabUploadLinks` rewrites upload destinations inside four-space-indented code blocks, so rendered and copied code samples no longer match the original comment. The fence check does not cover indented code; skip indented code lines before applying `RELATIVE_UPLOAD_PATTERN`. |
Leaving this as is on purpose. Four spaces of indentation is also how a paragraph or image continues inside a nested list item, and telling the two apart needs list tracking that a line pass does not have. Skipping indented lines would stop uploads in nested list items from loading. Rewriting a link inside an indented code block only makes the shown URL absolute, and it still points at the same file. Fenced blocks and inline code, the common forms, stay as written.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
| … | … | @@ -0,0 +1,98 @@ | |
| 74 | + | const base = projectUrl.replace(/\/+$/u, ""); | |
| 75 | + | let openFence: string | null = null; | |
| 76 | + | return markdown | |
| 77 | + | .split("\n") | |
🟠 High src/gitlabMedia.ts:77
resolveGitLabUploadLinks leaves valid multiline reference destinations such as [image]:\n/uploads/... relative, so clients do not route private-project images through the media proxy. Splitting markdown into lines before applying RELATIVE_UPLOAD_PATTERN means its reference-definition prefix and /uploads/ destination cannot match together; resolve reference definitions across line boundaries or transform parsed link and image nodes.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/shared/src/gitlabMedia.ts around line 77: |
| 2 | |
| 3 | `resolveGitLabUploadLinks` leaves valid multiline reference destinations such as `[image]:\n/uploads/...` relative, so clients do not route private-project images through the media proxy. Splitting `markdown` into lines before applying `RELATIVE_UPLOAD_PATTERN` means its reference-definition prefix and `/uploads/` destination cannot match together; resolve reference definitions across line boundaries or transform parsed link and image nodes. |
Fixed in e60ee43e50: a bare [label]: line now carries over to the next line, so a destination there is resolved too. Covered in gitlabMedia.test.ts.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.