List for cgit developers and users
 help / color / mirror / Atom feed
From: qznc at web.de (Andreas Zwinkau)
Subject: [PATCH 3/8] Skip forbidden characters.
Date: Wed, 2 Jul 2014 13:57:02 +0200	[thread overview]
Message-ID: <CAOqBtcfbz+PEqOUWLyzg+gFO06QeRzov8fJHYV_fOa2ATgjKMA@mail.gmail.com> (raw)
In-Reply-To: <20140701202903.GC13153@serenity.lan>

I asked Sebastian (commit author) about this old (Jan 2012) commit. It
fixed some breakage of some feed reader. Unfortunately, the real
reason is lost in time.

The change essentially filters out characters like (bell) or (record
separator) from HTML. Testing with my Google Chrome, \t\n\r are
rendered, the rest is skipped even inside <pre>.

Conclusion: It should probably not break anything. However, it should
not make a difference anyways. Just a workaround for some unknown bug.

On Tue, Jul 1, 2014 at 10:29 PM, John Keeping <john at keeping.me.uk> wrote:
> On Tue, Jul 01, 2014 at 09:40:28AM +0200, zwinkau at kit.edu wrote:
>> From: Sebastian Buchwald <Sebastian.Buchwald at kit.edu>
>
> Why do we want to do this?  Does it not break anything that uses
> whitespace="pre" (explicitly or implicitly)?
>
>> ---
>>  html.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/html.c b/html.c
>> index 91047ad..6037eec 100644
>> --- a/html.c
>> +++ b/html.c
>> @@ -129,7 +129,8 @@ void html_txt(const char *txt)
>>       const char *t = txt;
>>       while (t && *t) {
>>               int c = *t;
>> -             if (c == '<' || c == '>' || c == '&') {
>> +             if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
>> +                             || (c == '<' || c == '>' || c == '&')) {
>>                       html_raw(txt, t - txt);
>>                       if (c == '>')
>>                               html("&gt;");
>> @@ -150,7 +151,8 @@ void html_ntxt(int len, const char *txt)
>>       const char *t = txt;
>>       while (t && *t && len--) {
>>               int c = *t;
>> -             if (c == '<' || c == '>' || c == '&') {
>> +             if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
>> +                             || (c == '<' || c == '>' || c == '&')) {
>>                       html_raw(txt, t - txt);
>>                       if (c == '>')
>>                               html("&gt;");
>> @@ -186,7 +188,8 @@ void html_attr(const char *txt)
>>       const char *t = txt;
>>       while (t && *t) {
>>               int c = *t;
>> -             if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') {
>> +             if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&'
>> +                             || (c < 0x20 && c != '\t' && c != '\n' && c != '\r')) {
>>                       html_raw(txt, t - txt);
>>                       if (c == '>')
>>                               html("&gt;");
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit



-- 
Andreas Zwinkau

work email: zwinkau at kit.edu
private email: qznc at web.de
homepage: http://beza1e1.tuxen.de


  reply	other threads:[~2014-07-02 11:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01  7:40 [PATCH 1/8] Can add diffs to Atom feed entries zwinkau
2014-07-01  7:40 ` [PATCH 2/8] Improved readability zwinkau
2014-07-01  7:40 ` [PATCH 3/8] Skip forbidden characters zwinkau
2014-07-01 20:29   ` john
2014-07-02 11:57     ` qznc [this message]
2014-07-01  7:40 ` [PATCH 4/8] add xml-header to atom-feed zwinkau
2014-07-01  7:40 ` [PATCH 5/8] display updated, use urn/url for atom:id zwinkau
2014-07-01  7:40 ` [PATCH 6/8] only one content tag allowed, so remove the text one zwinkau
2014-07-01  7:40 ` [PATCH 7/8] add <link rel='self'> to atom feed zwinkau
2014-07-01  7:40 ` [PATCH 8/8] fix html error in diff output for binary files zwinkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOqBtcfbz+PEqOUWLyzg+gFO06QeRzov8fJHYV_fOa2ATgjKMA@mail.gmail.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).