Skip to content

Fix 500 error for erroneous content in markdown footnotes

Vasilii Iakliushin requested to merge 452051_fix_500_error into master

What does this MR do and why?

Contributes to #452051 (closed)

Problem

User can use a custom footnote syntax. The code cannot correctly handle the case when HTML links don't have an "id".

Solution

Handle the error by skipping malformed footnote links.

How to reproduce

  1. Update the README file of the project with a following content
<p>first<sup><a href="#fn-1" id="fnref-1" data-footnote-ref>1</a></sup> and second<sup><a href="#fn-second" id="fnref-second" data-footnote-ref>2</a></sup> and third<sup><a href="#fn-_%F0%9F%98%84_" id="fnref-_%F0%9F%98%84_" data-footnote-ref>3</a></sup></p>
<p>missing id<sup><a href="#fn-10" data-footnote-ref>1</a></sup></p>
<section data-footnotes>
<ol>
<li id="fn-1">
<p>one <a href="#fnref-1" data-footnote-backref data-footnote-backref-idx="1" aria-label="Back to reference 1">↩</a></p>
</li>
<li id="fn-second">
<p>two <a href="#fnref-second" data-footnote-backref data-footnote-backref-idx="2" aria-label="Back to reference 2">↩</a></p>
</li>\n<li id="fn-_%F0%9F%98%84_">
<p>three <a href="#fnref-_%F0%9F%98%84_" data-footnote-backref data-footnote-backref-idx="3" aria-label="Back to reference 3">↩</a></p>
</li>
</ol>
  1. It should be rendered without any errors (before it would return a 500 error)
Edited by Vasilii Iakliushin

Merge request reports