Skip to content

Limit the length of generated anchor URL for markdown headers

Vasilii Iakliushin requested to merge 204808_limit_anchor_href_length into master

What does this MR do and why?

Contributes to #204808

Problem

There is no limitation for generated header anchors. It might cause performance problems for long headers processing.

More details: https://gitlab.com/gitlab-org/gitlab/-/issues/204808#note_814064215

Solution

Limit anchor link length with 255 characters.

How to set up and validate locally

  1. Download snippet from https://gitlab.com/gitlab-org/gitlab/-/issues/204808#summary
  2. Go to new snippet page (http://127.0.0.1:3000/-/snippets/new)
  3. Paste snippet content and set filename to test.md
  4. Save snippet form
  5. Verify that the snippet was successfully created and accessible for a view

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports

Loading