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 765138 - Website links fails to show up when containing & signs
Website links fails to show up when containing & signs
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2016-04-16 10:15 UTC by Marcus Lundblad
Modified: 2016-09-06 19:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
placeBubble: Escape markup for website URIs (1.03 KB, patch)
2016-04-16 10:16 UTC, Marcus Lundblad
none Details | Review
placeBubble: Escape markup for website URIs (1.36 KB, patch)
2016-04-19 19:19 UTC, Marcus Lundblad
none Details | Review
placeBubble: Escape markup for website URIs (1.27 KB, patch)
2016-09-06 19:38 UTC, Marcus Lundblad
committed Details | Review

Description Marcus Lundblad 2016-04-16 10:15:36 UTC
If a website tag on an OSM object contains an & (using a URL format with request parameters) we get an error message and no link is rendered in the place bubble.
Comment 1 Marcus Lundblad 2016-04-16 10:16:11 UTC
Created attachment 326153 [details] [review]
placeBubble: Escape markup for website URIs
Comment 2 Marcus Lundblad 2016-04-16 10:21:40 UTC
The attached patch kinda works (you can now see the Website link label), but the tooltip is broken.
Something like:

(gnome-maps:31330): Gtk-WARNING **: Failed to set text 'http://www.mersmak.org/index.php?option=com_wrapper&view=wrapper&Itemid=204' from markup due to error parsing markup: Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as &

is printed by GTK+

To get an example, search for "bryggerimuséet arboga"
(the website URL seems to have broken since I added it a couple of years ago, and now points to some Japanese page, possible some domain for sale thing).
Comment 3 Marcus Lundblad 2016-04-19 19:19:51 UTC
Created attachment 326352 [details] [review]
placeBubble: Escape markup for website URIs
Comment 4 Marcus Lundblad 2016-04-19 19:26:29 UTC
With latest patch the tooltip displays properly.
Thanks to Timm Bädert for the hint!
Comment 5 Jonas Danielsson 2016-09-06 08:59:37 UTC
Review of attachment 326352 [details] [review]:

Looks good!

Fine to commit, if you agree with my nits, then please fix them up before committing!
Otherwise just commit!

::: src/placeBubble.js
@@ +201,3 @@
                 let text = expandedContent[row].linkText;
+                let uri = GLib.markup_escape_text(expandedContent[row].linkUrl,
+                                                  -1);

If we do not break this line, it will still not be as long as the "let a = " line?
Maybe just leave this un-broken?

@@ +203,3 @@
+                                                  -1);
+                /* we need to double-escape the tooltip text, as GTK+ treats it
+                   as markup */

Could we get this to one line by re-formulate? Otherwise have this style of multi-line:

/* [empty]
 * text line 1
 * text line 2
 */
Comment 6 Marcus Lundblad 2016-09-06 09:02:25 UTC
(In reply to Jonas Danielsson from comment #5)
> Review of attachment 326352 [details] [review] [review]:
> 
> Looks good!
> 
> Fine to commit, if you agree with my nits, then please fix them up before
> committing!
> Otherwise just commit!
> 
> ::: src/placeBubble.js
> @@ +201,3 @@
>                  let text = expandedContent[row].linkText;
> +                let uri =
> GLib.markup_escape_text(expandedContent[row].linkUrl,
> +                                                  -1);
> 
> If we do not break this line, it will still not be as long as the "let a = "
> line?
> Maybe just leave this un-broken?
> 

Sure, would probably be a good un-broken :)

> @@ +203,3 @@
> +                                                  -1);
> +                /* we need to double-escape the tooltip text, as GTK+
> treats it
> +                   as markup */
> 
> Could we get this to one line by re-formulate? Otherwise have this style of
> multi-line:
> 
> /* [empty]
>  * text line 1
>  * text line 2
>  */

Sure, can probably trim down that comment anyway!
Comment 7 Marcus Lundblad 2016-09-06 19:38:43 UTC
Created attachment 334929 [details] [review]
placeBubble: Escape markup for website URIs
Comment 8 Marcus Lundblad 2016-09-06 19:39:15 UTC
Attachment 334929 [details] pushed as 706ea4d - placeBubble: Escape markup for website URIs
Comment 9 Marcus Lundblad 2016-09-06 19:42:45 UTC
Thanks for the review!