Fossil SCM

When rendering HTML pages using the fossil-doc class and the data-title="..." attribute, reverse the HTML escapes in the argument to data-title since they will be reencoded prior to rendering.

drh 2019-08-01 21:05 trunk
Commit 54e01c60e21827d3d3cebb5195621817c7795b560ede60e3bc6fc8c60c42dad6
1 file changed +8 -1
+8 -1
--- src/doc.c
+++ src/doc.c
@@ -451,11 +451,18 @@
451451
if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0;
452452
seenClass = 1;
453453
if( seenTitle ) return 1;
454454
}
455455
if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){
456
- blob_append(pTitle, zValue, nValue);
456
+ /* The text argument to data-title="" will have had any characters that
457
+ ** are special to HTML encoded. We need to decode these before turning
458
+ ** the text into a title, as the title text will be reencoded later */
459
+ char *zTitle = mprintf("%.*s", nValue, zValue);
460
+ int i;
461
+ for(i=0; fossil_isspace(zTitle[i]); i++){}
462
+ html_to_plaintext(zTitle+i, pTitle);
463
+ fossil_free(zTitle);
457464
seenTitle = 1;
458465
if( seenClass ) return 1;
459466
}
460467
}
461468
return seenClass;
462469
--- src/doc.c
+++ src/doc.c
@@ -451,11 +451,18 @@
451 if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0;
452 seenClass = 1;
453 if( seenTitle ) return 1;
454 }
455 if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){
456 blob_append(pTitle, zValue, nValue);
 
 
 
 
 
 
 
457 seenTitle = 1;
458 if( seenClass ) return 1;
459 }
460 }
461 return seenClass;
462
--- src/doc.c
+++ src/doc.c
@@ -451,11 +451,18 @@
451 if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0;
452 seenClass = 1;
453 if( seenTitle ) return 1;
454 }
455 if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){
456 /* The text argument to data-title="" will have had any characters that
457 ** are special to HTML encoded. We need to decode these before turning
458 ** the text into a title, as the title text will be reencoded later */
459 char *zTitle = mprintf("%.*s", nValue, zValue);
460 int i;
461 for(i=0; fossil_isspace(zTitle[i]); i++){}
462 html_to_plaintext(zTitle+i, pTitle);
463 fossil_free(zTitle);
464 seenTitle = 1;
465 if( seenClass ) return 1;
466 }
467 }
468 return seenClass;
469

Keyboard Shortcuts

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