Fossil SCM

Single quote in wiki page title results in bad link from timeline, [x](wiki:y'z)

Fixed

4e558dbf3d2511c… · opened 5 years, 6 months ago

Type
Code_Defect
Priority
Immediate
Severity
Important
Resolution
Fixed
Subsystem
Created
Sept. 28, 2020 2:47 p.m.

I have created a wiki page with a single quote character in the title on my site. When I look at the timeline, the link to the wiki page is broken: the single quote is escaped twice.

<span class='timelineModernComment'>
Changes to wiki page <a href="/wiki?name=Goethe%26%2339%3Bs+Poems+translated+by+Paul+Dyrsen">Goethe&#39;s Poems translated by Paul Dyrsen</a>
</span>

It is also a problem to link to this page with the [](wiki:) syntax. [foo](Goethe's Poems translated by Paul Dyrsen) translates to <a href="/projects/fossil-scm/fossil/wiki/page/Goethe%27">foo</a>. Escaping the single quote with a slash does not change that.

A fresh Fossil repository with the issue.

Comments (2)

dbohdan 5 years, 6 months ago

I have created a wiki page with a single quote character in the title on my site. When I look at the timeline, the link to the wiki page is broken: the single quote is escaped twice.

<span class='timelineModernComment'>
Changes to wiki page <a href="/wiki?name=Goethe%26%2339%3Bs+Poems+translated+by+Paul+Dyrsen">Goethe&#39;s Poems translated by Paul Dyrsen</a>
</span>

It is also a problem to link to this page with the [](wiki:) syntax. [foo](Goethe's Poems translated by Paul Dyrsen) translates to <a href="/projects/fossil-scm/fossil/wiki/page/Goethe%27">foo</a>. Escaping the single quote with a slash does not change that.

A fresh Fossil repository with the issue.

ivz_hh 5 years, 4 months ago

get_link_inline recognizes quote as start of title. This code tries to accept escaped quote.

Index: src/markdown.c
==================================================================
--- src/markdown.c
+++ src/markdown.c
@@ -932,11 +932,11 @@
   /* skipping initial whitespace */
   while( i<size && (data[i]==' ' || data[i]=='\t' || data[i]=='\n') ){ i++; }
   link_b = i;

   /* looking for link end: ' " */
-  while( i<size && data[i]!='\'' && data[i]!='"' ){ i++; }
+  while( i<size && (data[i]!='\'' && data[i]!='"' || (0<i && data[i-1]=='\\')) ){ i++; }
   link_e = i;

   /* looking for title end if present */
   if( data[i]=='\'' || data[i]=='"' ){
     i++;

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button