New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

Patch for space seperated bword links.

Report bugs here

Patch for space seperated bword links.

Postby zhangjinsong » Tue Oct 05, 2010 7:26 am

Bug report is here: http://goldendict.org/forum/viewtopic.php?f=6&t=882

After a lot of googling, I found it difficult to replace my problematic Babylon dictionaries to their dsl counterparts because of my complete ignorance of Russian language.
Then I wrote this patch.
Here it is, see attachment, it works fine.
Attachments
fix_bword.patch.tar.bz2
OUTDATED, please use the patch in attachment of #5.
(1.06 KiB) Downloaded 771 times
Last edited by zhangjinsong on Thu Oct 07, 2010 2:26 am, edited 2 times in total.
zhangjinsong
 
Posts: 28
Joined: Sat Oct 31, 2009 7:05 am

Re: Patch for space seperated bword links.

Postby ikm » Tue Oct 05, 2010 5:49 pm

Could you elaborate how this patch works exactly?
ikm
Автор GoldenDict
 
Posts: 1595
Joined: Wed Feb 04, 2009 10:40 am

Re: Patch for space seperated bword links.

Postby zhangjinsong » Wed Oct 06, 2010 1:27 am

OK, if the following contains any errors, let me know please.

Qtwebkit (at least 4.6.X) can't handle any URI with its host part containing space character or "%20" or something similar, but if those offending characters are in the path part, everything goes OK.
In GD, the host part of "bword" scheme is completely useless, its host part and path part are altogether sent to "gdlookup" scheme URI as its query item.

Obviously, in GD, "bword" scheme should be non-hierarchical, like "mailto", as explained by RFC3986, with the whole "location identifier" as its path part.

So, there is a simple solution to that problem: make "bword" the same as "mailto", that is, disable its host part, as the patch does.

Er, it seems I forgot to delete the code handling the host part (now, it's an empty string) of "bword" link in ArticleView::openLink() function, the new patch is in the attachment of this post.
Attachments
fix_bword_2.patch.tar.bz2
Outdated, use the patch in #5
(1.34 KiB) Downloaded 763 times
Last edited by zhangjinsong on Thu Oct 07, 2010 2:25 am, edited 1 time in total.
zhangjinsong
 
Posts: 28
Joined: Sat Oct 31, 2009 7:05 am

Re: Patch for space seperated bword links.

Postby ikm » Wed Oct 06, 2010 5:36 pm

Fair enough. However, please do the bword replacements in bgl.cc:673, after replaceCharsetEntities, not in bgl_babylon, which shouldn't be doing GD-specific transforms. This way you also wouldn't need to bump up the ParserVersion.
ikm
Автор GoldenDict
 
Posts: 1595
Joined: Wed Feb 04, 2009 10:40 am

Re: Patch for space seperated bword links.

Postby zhangjinsong » Thu Oct 07, 2010 2:25 am

OK, the new patch is here.
Attachments
fix_bword_3.patch.tar.bz2
(1.23 KiB) Downloaded 741 times
zhangjinsong
 
Posts: 28
Joined: Sat Oct 31, 2009 7:05 am

Re: Patch for space seperated bword links.

Postby ikm » Thu Oct 07, 2010 5:36 am

Great work! Patch applied.
ikm
Автор GoldenDict
 
Posts: 1595
Joined: Wed Feb 04, 2009 10:40 am

Re: Patch for space seperated bword links.

Postby zhangjinsong » Sun Oct 10, 2010 7:34 am

Hi, ikm:
It seems stardict also use "bword://" in its internal cross reference, so stardict.cc need to be patched too.
The patch is here, see attachment.
Attachments
fix_stardict_bword.patch.tar.bz2
Patch for stardict.
(470 Bytes) Downloaded 775 times
zhangjinsong
 
Posts: 28
Joined: Sat Oct 31, 2009 7:05 am

Re: Patch for space seperated bword links.

Postby ikm » Mon Oct 11, 2010 2:44 am

Applied, thanks.
ikm
Автор GoldenDict
 
Posts: 1595
Joined: Wed Feb 04, 2009 10:40 am


Return to Bugs

Who is online

Users browsing this forum: No registered users and 31 guests

cron