After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 436994 - file hyperlinks include the space character before them
file hyperlinks include the space character before them
Status: RESOLVED FIXED
Product: tomboy
Classification: Applications
Component: General
unspecified
Other All
: Normal minor
: ---
Assigned To: Tomboy Maintainers
Tomboy Maintainers
: 529568 (view as bug list)
Depends on:
Blocks: 529568
 
 
Reported: 2007-05-08 20:26 UTC by Ori Avtalion
Modified: 2009-05-09 13:06 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Removed whitespace matching from regex (535 bytes, patch)
2008-05-02 15:35 UTC, Stefan Schweizer
committed Details | Review
Remove word boundary check and optional / ending in regexpr. (537 bytes, patch)
2009-03-02 14:48 UTC, Florian Pinault
none Details | Review
Fix extraneous URL matchings, like this/that/other matching "/that/other", following up on bug #436994. (1.05 KB, patch)
2009-04-25 16:03 UTC, Sandy Armstrong
none Details | Review

Description Ori Avtalion 2007-05-08 20:26:25 UTC
Please describe the problem:
When typing a file name, it is highlighted along with the space that precedes the file name (if it's not the start of a line).

Using svn revision 1163.

Steps to reproduce:
1. Create a new note
2. Type in "foo ~/bar"


Actual results:
The text " ~/bar" is hyperlinked

Expected results:
Only "~/bar" should be hyperlinked

Does this happen every time?
Yes

Other information:
The leading space in the URL is a known problem:
http://svn.gnome.org/viewcvs/tomboy/trunk/Tomboy/Watchers.cs?annotate=HEAD#l380
Comment 1 Boyd Timothy 2008-02-26 19:15:54 UTC
Setting the default assignee and QA Contact to "tomboy-maint@gnome.bugs".
Comment 2 Stefan Schweizer 2008-05-01 11:29:27 UTC
Thanks for reporting this and sorry for our late response.

This is the current behaviour as I understand it: The regular expression in the NoteUrlWatcher class (Watchers.cs) matches preceding whitespace for files. Not only the space character is shown as a link, also a preceding new line (see bug #529568). When the link is activated, the whitespace is removed and the url is opened.
Comment 3 Stefan Schweizer 2008-05-02 15:35:13 UTC
Created attachment 110279 [details] [review]
Removed whitespace matching from regex

I tried to fix the regular expression and removed the parts that were matching whitespace. I am not very good with regular expressions, so it is possible that I destroyed something. I also do not know what the whitespace matching with (^|\s) was intended to do.
Comment 4 Florian Pinault 2009-03-02 14:48:31 UTC
Created attachment 129851 [details] [review]
Remove word boundary check and optional / ending in regexpr.

Sorry, I don't see your patch working for
http://bugzilla.gnome.org/thing)

I would do this : see patch.

The question is :

Do we allow url ending with ) , ( , or even " such as 
http://bugzilla.gnome.org/thing)
http://bugzilla.gnome.org/thing"
http://bugzillagnomeorgthing,+:-)@"^

The patch allows everything.
Comment 5 Stefan Schweizer 2009-03-02 15:25:50 UTC
(In reply to comment #4)
> Sorry, I don't see your patch working for
> http://bugzilla.gnome.org/thing)

That's because this bug and the patch is about the space that is hyperlinked before file links. I think there is another bug somewhere for parentheses. I do not know if my patch still works, will test it today.
Comment 6 Stefan Schweizer 2009-03-02 17:58:40 UTC
The patch still works for me, the blank and the new line are not linked any more. Though I am not completely sure what I did back then.

Florian, can you attach your patch to bug #531085?
Comment 7 Sandy Armstrong 2009-03-02 22:01:27 UTC
*** Bug 529568 has been marked as a duplicate of this bug. ***
Comment 8 Sandy Armstrong 2009-03-02 22:16:23 UTC
Stefan, committed your patch in r2397.  Will look at Florian's as part of bug #531085 as suggested.

I'm not sure I understand what corner case was supposed to be covered by the original regex. I hope it is an obsolete one. :-)  We really need unit tests for this stuff.
Comment 9 Sandy Armstrong 2009-04-25 15:29:57 UTC
Well, I found out the corner case this was regex was addressing.  Try typing "this/that/other", and notice how "/that/other" becomes linked as a URL.  Working on a better fix now (probably the same as the previous regex, but without *including* the leading whitespace in the match).
Comment 10 Sandy Armstrong 2009-04-25 16:03:26 UTC
Created attachment 133294 [details] [review]
Fix extraneous URL matchings, like this/that/other matching "/that/other", following up on bug #436994.

Restore the original regular expression with checks for leading whitespace, but make sure to use zero-width positive lookbehind assertion to keep leading whitespace out of the match.
Comment 11 Sandy Armstrong 2009-04-25 16:05:38 UTC
By the way, I just used git-bz to create comment #10 (and the attachment) in one easy command.

http://blog.fishsoup.net/2008/11/16/git-bz-bugzilla-subcommand-for-git/

After committing the change locally, the command I used was:
git-bz attach bugzilla.gnome.org:436994 HEAD^

Anyway, if somebody wants to play with this before I push it, that would be cool.  Release on Monday afaik (they were talking about pushing it back because of delays caused by git migration).
Comment 12 Sandy Armstrong 2009-05-09 13:06:11 UTC
Oh, forgot to mark this is fixed.