Fossil

View Ticket
Login
Ticket Hash: 4e558dbf3d2511ce5dbe52897900760da95fd272
Title: Single quote in wiki page title results in bad link from timeline, [x](wiki:y'z)
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2020-11-25 21:57:54
5.35 years ago
Created: 2020-09-28 14:47:55
5.51 years ago
Version Found In: 2.12.1
User Comments:
dbohdan added on 2020-09-28 14:47:55:

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="/wiki?name=Goethe%27">foo</a>. Escaping the single quote with a slash does not change that.

A fresh Fossil repository with the issue.


ivz_hh added on 2020-11-24 05:41:32:

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++;