Fossil SCM

The "formatted" mode for the ticket history viewer assumed that all text was Fossil-Wiki formatted. It did not account for Markdown (since that feature was added long before Markdown formatting was added). And, indeed, there is no general way for it to know what the mimetype of the text is. Hence, disable formatted mode, and show all text as plaintext.

drh 2020-03-22 15:33 trunk
Commit f1e8cd6977e0de32fc5b7e12a2492c8058daadfbbd507faba5aff0c4c204cf1b
1 file changed +14 -26
+14 -26
--- src/tkt.c
+++ src/tkt.c
@@ -935,15 +935,15 @@
935935
** URL: /tkthistory?name=TICKETUUID
936936
**
937937
** Show the complete change history for a single ticket. Or (to put it
938938
** another way) show a list of artifacts associated with a single ticket.
939939
**
940
-** By default, the artifacts are decoded and formatted. If the
941
-** "plaintext" query parameter is present, then icomment text fields
942
-** are shown as plain text rather than being formatted according
943
-** to mimetype. Or if the "raw" query parameter is present, then the
944
-** undecoded and unformatted text of each artifact is displayed.
940
+** By default, the artifacts are decoded and formatted. Text fields
941
+** are formatted as text/plain, since in the general case Fossil does
942
+** not have knowledge of the encoding. If the "raw" query parameter
943
+** is present, then the* undecoded and unformatted text of each artifact
944
+** is displayed.
945945
*/
946946
void tkthistory_page(void){
947947
Stmt q;
948948
char *zTitle;
949949
const char *zUuid;
@@ -960,22 +960,13 @@
960960
style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
961961
style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
962962
g.zTop, zUuid);
963963
style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
964964
if( P("raw")!=0 ){
965
- style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
966
- style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
967
- }else if( P("plaintext")!=0 ){
968
- style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
969
- if( g.perm.Admin ){
970
- style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
971
- }
972
- }else{
973
- style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
974
- if( g.perm.Admin ){
975
- style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
976
- }
965
+ style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
966
+ }else if( g.perm.Admin ){
967
+ style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
977968
}
978969
style_header("%z", zTitle);
979970
980971
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
981972
if( tagid==0 ){
@@ -983,10 +974,12 @@
983974
style_footer();
984975
return;
985976
}
986977
if( P("raw")!=0 ){
987978
@ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
979
+ }else{
980
+ @ <h2>Artifacts Associated With Ticket %h(zUuid)</h2>
988981
}
989982
db_prepare(&q,
990983
"SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
991984
" FROM event, blob"
992985
" WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
@@ -1072,31 +1065,26 @@
10721065
** description of this object.
10731066
*/
10741067
void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){
10751068
int i;
10761069
int wikiFlags = WIKI_NOBADLINKS;
1077
- const char *zBlock = "<blockquote>";
1078
- const char *zEnd = "</blockquote>";
1079
- if( P("plaintext")!=0 ){
1080
- wikiFlags |= WIKI_LINKSONLY;
1081
- zBlock = "<blockquote><pre class='verbatim'>";
1082
- zEnd = "</pre></blockquote>";
1083
- }
1070
+ const char *zBlock = "<blockquote><pre class='verbatim'>";
1071
+ const char *zEnd = "</pre></blockquote>";
10841072
if( zListType==0 ) zListType = "1";
10851073
@ <ol type="%s(zListType)">
10861074
for(i=0; i<pTkt->nField; i++){
10871075
Blob val;
10881076
const char *z;
10891077
z = pTkt->aField[i].zName;
10901078
blob_set(&val, pTkt->aField[i].zValue);
10911079
if( z[0]=='+' ){
10921080
@ <li>Appended to %h(&z[1]):%s(zBlock)
1093
- wiki_convert(&val, 0, wikiFlags);
1081
+ @ %h(blob_str(&val))
10941082
@ %s(zEnd)</li>
10951083
}else if( blob_size(&val)>50 || contains_newline(&val) ){
10961084
@ <li>Change %h(z) to:%s(zBlock)
1097
- wiki_convert(&val, 0, wikiFlags);
1085
+ @ %h(blob_str(&val))
10981086
@ %s(zEnd)</li>
10991087
}else{
11001088
@ <li>Change %h(z) to "%h(blob_str(&val))"</li>
11011089
}
11021090
blob_reset(&val);
11031091
--- src/tkt.c
+++ src/tkt.c
@@ -935,15 +935,15 @@
935 ** URL: /tkthistory?name=TICKETUUID
936 **
937 ** Show the complete change history for a single ticket. Or (to put it
938 ** another way) show a list of artifacts associated with a single ticket.
939 **
940 ** By default, the artifacts are decoded and formatted. If the
941 ** "plaintext" query parameter is present, then icomment text fields
942 ** are shown as plain text rather than being formatted according
943 ** to mimetype. Or if the "raw" query parameter is present, then the
944 ** undecoded and unformatted text of each artifact is displayed.
945 */
946 void tkthistory_page(void){
947 Stmt q;
948 char *zTitle;
949 const char *zUuid;
@@ -960,22 +960,13 @@
960 style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
961 style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
962 g.zTop, zUuid);
963 style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
964 if( P("raw")!=0 ){
965 style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
966 style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
967 }else if( P("plaintext")!=0 ){
968 style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
969 if( g.perm.Admin ){
970 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
971 }
972 }else{
973 style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
974 if( g.perm.Admin ){
975 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
976 }
977 }
978 style_header("%z", zTitle);
979
980 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
981 if( tagid==0 ){
@@ -983,10 +974,12 @@
983 style_footer();
984 return;
985 }
986 if( P("raw")!=0 ){
987 @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
 
 
988 }
989 db_prepare(&q,
990 "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
991 " FROM event, blob"
992 " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
@@ -1072,31 +1065,26 @@
1072 ** description of this object.
1073 */
1074 void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){
1075 int i;
1076 int wikiFlags = WIKI_NOBADLINKS;
1077 const char *zBlock = "<blockquote>";
1078 const char *zEnd = "</blockquote>";
1079 if( P("plaintext")!=0 ){
1080 wikiFlags |= WIKI_LINKSONLY;
1081 zBlock = "<blockquote><pre class='verbatim'>";
1082 zEnd = "</pre></blockquote>";
1083 }
1084 if( zListType==0 ) zListType = "1";
1085 @ <ol type="%s(zListType)">
1086 for(i=0; i<pTkt->nField; i++){
1087 Blob val;
1088 const char *z;
1089 z = pTkt->aField[i].zName;
1090 blob_set(&val, pTkt->aField[i].zValue);
1091 if( z[0]=='+' ){
1092 @ <li>Appended to %h(&z[1]):%s(zBlock)
1093 wiki_convert(&val, 0, wikiFlags);
1094 @ %s(zEnd)</li>
1095 }else if( blob_size(&val)>50 || contains_newline(&val) ){
1096 @ <li>Change %h(z) to:%s(zBlock)
1097 wiki_convert(&val, 0, wikiFlags);
1098 @ %s(zEnd)</li>
1099 }else{
1100 @ <li>Change %h(z) to "%h(blob_str(&val))"</li>
1101 }
1102 blob_reset(&val);
1103
--- src/tkt.c
+++ src/tkt.c
@@ -935,15 +935,15 @@
935 ** URL: /tkthistory?name=TICKETUUID
936 **
937 ** Show the complete change history for a single ticket. Or (to put it
938 ** another way) show a list of artifacts associated with a single ticket.
939 **
940 ** By default, the artifacts are decoded and formatted. Text fields
941 ** are formatted as text/plain, since in the general case Fossil does
942 ** not have knowledge of the encoding. If the "raw" query parameter
943 ** is present, then the* undecoded and unformatted text of each artifact
944 ** is displayed.
945 */
946 void tkthistory_page(void){
947 Stmt q;
948 char *zTitle;
949 const char *zUuid;
@@ -960,22 +960,13 @@
960 style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
961 style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
962 g.zTop, zUuid);
963 style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
964 if( P("raw")!=0 ){
965 style_submenu_element("Decoded", "%R/tkthistory/%s", zUuid);
966 }else if( g.perm.Admin ){
967 style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
 
 
 
 
 
 
 
 
 
968 }
969 style_header("%z", zTitle);
970
971 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
972 if( tagid==0 ){
@@ -983,10 +974,12 @@
974 style_footer();
975 return;
976 }
977 if( P("raw")!=0 ){
978 @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
979 }else{
980 @ <h2>Artifacts Associated With Ticket %h(zUuid)</h2>
981 }
982 db_prepare(&q,
983 "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
984 " FROM event, blob"
985 " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
@@ -1072,31 +1065,26 @@
1065 ** description of this object.
1066 */
1067 void ticket_output_change_artifact(Manifest *pTkt, const char *zListType){
1068 int i;
1069 int wikiFlags = WIKI_NOBADLINKS;
1070 const char *zBlock = "<blockquote><pre class='verbatim'>";
1071 const char *zEnd = "</pre></blockquote>";
 
 
 
 
 
1072 if( zListType==0 ) zListType = "1";
1073 @ <ol type="%s(zListType)">
1074 for(i=0; i<pTkt->nField; i++){
1075 Blob val;
1076 const char *z;
1077 z = pTkt->aField[i].zName;
1078 blob_set(&val, pTkt->aField[i].zValue);
1079 if( z[0]=='+' ){
1080 @ <li>Appended to %h(&z[1]):%s(zBlock)
1081 @ %h(blob_str(&val))
1082 @ %s(zEnd)</li>
1083 }else if( blob_size(&val)>50 || contains_newline(&val) ){
1084 @ <li>Change %h(z) to:%s(zBlock)
1085 @ %h(blob_str(&val))
1086 @ %s(zEnd)</li>
1087 }else{
1088 @ <li>Change %h(z) to "%h(blob_str(&val))"</li>
1089 }
1090 blob_reset(&val);
1091

Keyboard Shortcuts

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