Fossil

Check-in [d81e2176]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix html escaping of TH1 variables. Escaping should be determined by $ or $a form, but instead it was based on the relationship between the length of the variable name and the length of the value.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | steveb-fixes
Files: files | file ages | folders
SHA1:d81e217651dc68a8f034f396cb6ddb78dfa35ba5
User & Date: steveb 2011-11-04 18:57:30
Context
2011-11-04
19:10
Merge the steveb-fixes branch into trunk. check-in: aeec10b9 user: drh tags: trunk
18:57
Fix html escaping of TH1 variables. Escaping should be determined by $ or $a form, but instead it was based on the relationship between the length of the variable name and the length of the value. Closed-Leaf check-in: d81e2176 user: steveb tags: steveb-fixes
18:49
Ensure correct file name on compile errors in translated sources. This helps avoid editing the generated file with vim "quickfix". check-in: ae965ddf user: steveb tags: steveb-fixes
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/th_main.c.

480
481
482
483
484
485
486

487
488
489
490
491
492
493
494
495

496
497
498
499
500
501
502
503
504
505
506
507
508
  int rc = TH_OK;
  char *zResult;
  Th_FossilInit();
  while( z[i] ){
    if( z[i]=='$' && (n = validVarName(&z[i+1]))>0 ){
      const char *zVar;
      int nVar;

      sendText(z, i, 0);
      if( z[i+1]=='<' ){
        /* Variables of the form $<aaa> */
        zVar = &z[i+2];
        nVar = n-2;
      }else{
        /* Variables of the form $aaa */
        zVar = &z[i+1];
        nVar = n;

      }
      rc = Th_GetVar(g.interp, (char*)zVar, nVar);
      z += i+1+n;
      i = 0;
      zResult = (char*)Th_GetResult(g.interp, &n);
      sendText((char*)zResult, n, n>nVar);
    }else if( z[i]=='<' && isBeginScriptTag(&z[i]) ){
      sendText(z, i, 0);
      z += i+5;
      for(i=0; z[i] && (z[i]!='<' || !isEndScriptTag(&z[i])); i++){}
      rc = Th_Eval(g.interp, 0, (const char*)z, i);
      if( rc!=TH_OK ) break;
      z += i;







>


|



|


>





|







480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
  int rc = TH_OK;
  char *zResult;
  Th_FossilInit();
  while( z[i] ){
    if( z[i]=='$' && (n = validVarName(&z[i+1]))>0 ){
      const char *zVar;
      int nVar;
      int encode = 1;
      sendText(z, i, 0);
      if( z[i+1]=='<' ){
        /* Variables of the form $<aaa> are html escaped */
        zVar = &z[i+2];
        nVar = n-2;
      }else{
        /* Variables of the form $aaa are output raw */
        zVar = &z[i+1];
        nVar = n;
        encode = 0;
      }
      rc = Th_GetVar(g.interp, (char*)zVar, nVar);
      z += i+1+n;
      i = 0;
      zResult = (char*)Th_GetResult(g.interp, &n);
      sendText((char*)zResult, n, encode);
    }else if( z[i]=='<' && isBeginScriptTag(&z[i]) ){
      sendText(z, i, 0);
      z += i+5;
      for(i=0; z[i] && (z[i]!='<' || !isEndScriptTag(&z[i])); i++){}
      rc = Th_Eval(g.interp, 0, (const char*)z, i);
      if( rc!=TH_OK ) break;
      z += i;