Latest Posts

Topic: Bugs

janus
Avatar
Joined: 2016-06-22, 19:26
Posts: 13
OS: Haiku R1/Beta3
Version: Build 42
Ranking
Pry about Widelands
Location: some where over the rainbow
Posted at: 2016-06-22, 19:33

das problem mit den klammern ist, das beim in die datenbank ablegen der string html konform umgewandelt wird und dann beim auslesen noch mal, das problem ist hier das und zeichen. an einer stelle sollte das nicht gemacht werden dann wird es regelgerecht angezeigt. die frage ist hier, wo.


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 19:59

Nochmal ein test:

< > &


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 22:06

non alphabet signs: < > ! @ # $ % ^ & * ( ) ~ ` { } [ ] \ | ; : ' " , . /


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 22:07

testing backticks: &gt;


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 22:11

Evil script code: <script>alert("II am evil")</script>


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 22:17

Code blocks:

chunk = chunk.replaceWith(django_urlize(unicode(unescape(chunk))))

This is "text in double quotes" and 'single quotes'

And a link: https://code.launchpad.net/~widelands-dev/widelands-website/django1_8

is this quoted?

And text with a\backslash

And an ampersand: &


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 22:28

kaputtnik wrote:

Code blocks:

~~~~ chunk = chunk.replaceWith(django_urlize(unicode(unescape(chunk)))) ~~~~

This is "text in double quotes" and 'single quotes'

And a link: https://code.launchpad.net/~widelands-dev/widelands-website/django1_8

is this quoted?

And text with a\backslash

And an ampersand: &

Quoting a post


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 22:40

What about power: 6² = 36


Top Quote
einstein13
Avatar
Joined: 2016-06-21, 00:06
Posts: 8
Ranking
Pry about Widelands
Location: Poland
Posted at: 2016-06-22, 22:43

As I can see, you were able to find the solution! Great! Where was that? face-smile.png


Hey, this is my wrong signature :P

Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2016-06-18, 12:48
Posts: 76
Ranking
Likes to be here
Posted at: 2016-06-22, 23:13

It was in function urlize

Near at the end there is django_urlize() called which should only turn text urls (like http://someurl.org) into clickable links. The problem is that this is used on html preformatted text and django_urlize is intended to work on plaintext. See the note at the end of the chapter. The preformatted text contains html entities, like &gt;, which get formatted again with the urlize filter (to &amp;gt;). The solution was to unescape such special characters before django_urlize went over it. So &gt; get > and after urlizing it get back to &gt; again. The function unescape() is a part or pybb/utils.py and was introduced by janus, thanks for it face-smile.png

Don't know why this is working with the current site. Somehow the code of urlize was changed between Django 1.3.7 and Django 1.8 but i couldn't find the related changes.


Top Quote