Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.36k stars 4.79k forks source link

pin name can't have a ' #40862

Closed DavidThielen closed 4 months ago

DavidThielen commented 9 months ago

Library name and version

Azure.Maps.Rendering 1.0.0-beta.2

Describe the bug

If the name passed to PushpinPosition has a ' in it, such as "Dave's Home", you get the following:

{"pins":["Invalid format for location value ''Dave's home'-105.13008 39.98274'. Expected a floating-point longitude between -180 and 180."]}

Expected behavior

It can handle names with a '

Actual behavior

It throws an exception

Reproduction Steps

example here

Environment

Windows 11 on a desktop. App is Blazor server .NET 8

DavidThielen commented 9 months ago

Please let me know how to escape a ' and if there's any other characters it chokes over.

DavidThielen commented 9 months ago

Also, if this SDK is open source, please point me to it. I'll fix the 2 bugs I found - should only take 1/2 hour or so.

thanks - dave

dubiety commented 9 months ago

Hi @DavidThielen, We're looking into this issue and will get back to you soon. Thank you very much for reporting this issue!

jecmenicanikola commented 6 months ago

I could reproduce this as described. After investigation, I found that the problem is on the server side. A direct call to the REST API yields the same result.

curl --location 'https://atlas.microsoft.com/map/static/png?api-version=2022-08-01&bbox=13.228%2C52.4559%2C13.5794%2C52.629&language=&pins=default%7CcoFF00FF%7Csc0.8%7Clc008000%7Cls10%7C%7C%27Dave%27s%20home%2712.56%2022.56' \
--header 'Accept: "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile"' \
--header 'x-ms-client-request-id: REQUEST-ID' \
--header 'x-ms-return-client-request-id: true' \
--header 'subscription-key: KEY'

returns:

400 Bad Request with message "{
    "pins": [
        "Invalid format for location value ''Dave's home'12.56 22.56'. Expected a floating-point longitude between -180 and 180."
    ]
}"

It's possible to work around this by replacing ' with \u2019.

jecmenicanikola commented 6 months ago

This was fixed on the server side.

dubiety commented 4 months ago

It's fixed and now it's working. @DavidThielen, please let us know if you still encounter any problem. I'll close this issue now. Thank you again for reporting this issue!