2012/2/28 Lluís Batlle i Rossell <[email protected]>:
> On Wed, Feb 22, 2012 at 09:51:44AM +0100, Lluís Batlle i Rossell wrote:
>> Hello,
>>
>> the fdiff page, patch mode, has HTML in it:
>>
>> One example:
>> http://fossil-scm.org/index.html/fdiff?v1=806340fbc989550a&v2=f1d6ecabf37517e4&patch
>
> Isn't this problem important for a fix? I just write as a reminder...
>

Yes, I do consider it an annoyance worth fixing. Please, find my patch
below. It prevents HTML tags from appearing in the plain text patch in
fdiff webpage. I cross-post this message to Richard and to the
fossil-dev list. Hopefully, the developers will find time to apply it.
The patch is against fossil trunk [8f496ed159].

--Leo--
This patch is against fossil trunk [8f496ed159]

Index: src/info.c
==================================================================
--- src/info.c~0	2012-03-24 16:21:59.000000000 -0400
+++ src/info.c	2012-03-24 16:03:26.000000000 -0400
@@ -1078,11 +1078,11 @@ void diff_page(void){
   int isPatch;
   int sideBySide;
   Blob c1, c2, diff, *pOut;
   char *zV1;
   char *zV2;
-  int diffFlags;
+  int diffFlags = 0;
   const char *zStyle = "sbsdiff";
 
   login_check_credentials();
   if( !g.perm.Read ){ login_needed(); return; }
   v1 = name_to_rid_www("v1");
@@ -1093,25 +1093,24 @@ void diff_page(void){
   zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
   isPatch = P("patch")!=0;
   if( isPatch ){
     pOut = cgi_output_blob();
     cgi_set_content_type("text/plain");
-    diffFlags = 4;
   }else{
     blob_zero(&diff);
     pOut = &diff;
-    diffFlags = construct_diff_flags(1, sideBySide);
+    diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
     if( sideBySide ){
       zStyle = "sbsdiff";
     }else{
       diffFlags |= DIFF_LINENO;
       zStyle = "udiff";
     }
   }
   content_get(v1, &c1);
   content_get(v2, &c2);
-  text_diff(&c1, &c2, pOut, diffFlags | DIFF_HTML );
+  text_diff(&c1, &c2, pOut, diffFlags );
   blob_reset(&c1);
   blob_reset(&c2);
   if( !isPatch ){
     style_header("Diff");
     style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to