Closed (fixed)
Project:
GMap Module
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 May 2006 at 04:51 UTC
Updated:
3 Jun 2006 at 20:15 UTC
I ran across a problem on my site where the title of a location aware node contained a single quote, as in:
"This is gmap's best feature"
The single quote was mistaken as a string terminator, and the JavaScript addOverlay calls on nodes with single quotes in the title failed to parse. No google map was displayed, and my page was far less interesting.
A check_plain() did the trick, nicely formatting up special characters into HTML entities. Adding it took care of my little quote problem. Here is the patch against the current cvs version:
142c142
< $newmarker['tooltip']=check_plain($n->title);
---
> $newmarker['tooltip']=$n->title;
Comments
Comment #1
webgeer commentedThanks for this. It is now fixed in cvs. I also applied similar approach to a few other locaitons. However, I really have to go through and do better text checking in general.
Comment #2
scott.mclewin commentedNot a problem. It occurred to me last night that the check_plain call probably belonged at the point where the gmap module emits the JavaScript rather than at the point of input into the array of markers, which is what I did with the patch. That way any use of the mapping by anybody will catch this, not just the uses in the location module.
Thanks for wrapping google's mapping apis. This is a handy module pair.
Comment #3
webgeer commentedOf course you are right, it should be done just before it is printed. I will move this from gmap_location to gmap.module later.
Thanks for the suggestion.
Comment #4
(not verified) commented