ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

Clicking on POI with an apostrophe in its name causes a SyntaxError #156

Closed jstephani2 closed 5 years ago

jstephani2 commented 5 years ago

I'm submitting a ... (check one with "x")

If you choose 'problem or bug report', please select OS: (check one with "x")

cordova information: (run $> cordova plugin list)

cordova-plugin-advanced-http 2.0.2 "Advanced HTTP plugin"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.4.6 "cordova-plugin-googlemaps"
cordova-plugin-googleplaces 0.0.5 "Google Places"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.3.1 "cordova-plugin-ionic-webview"
cordova-plugin-secure-storage 3.0.1 "SecureStorage"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly) "@ionic-native/core": "^4.18.0", "@ionic-native/google-maps": "^4.15.1"

Current behavior:

this.map.addEventListener(GoogleMapsEvent.POI_CLICK).subscribe(event => {
            console.log(event);
        });

upon clicking a POI (with an apostrophe in the name) in the app: Uncaught SyntaxError: Unexpected identifier is shown in the console

Digging into the error, I find:

if('map_0_1384549610302' in plugin.google.maps){plugin.google.maps['map_0_1384549610302']({evtName: 'poi_click', callback:'_onMapEvent', args:['ChIJAAAAAAAAAAARaC_Ym6jkMgg', 'University ofWisconsin - Madison'sBotanical…', new plugin.google.maps.LatLng(43.073627, -89.404134)]});}

It looks as if apostrophes not being escaped is causing the issue. This works fine with POI's that don't have apostrophes in their names.

wf9a5m75 commented 5 years ago

Thank you for reporting. I will confirm it.

wf9a5m75 commented 5 years ago

Fixed. Thank you for reporting.