Calendar URL encoded

Please provide the following:

  1. SDK Version: 35.0.0
  2. Platforms(Android/iOS/web/all): iOS

When I call Calendar.createEventAsync with url in details object, the url is encoded when I open created calendar event in iOS.

So if I call:
await Calendar.createEventAsync(calendarId, { …, url: ‘http://www.expo.io/test’})
URL in calendar event is:
http%3A%2F%2Fwww.expo.io%2Ftest
and you obviously can’t open it by clicking.

How should the URL be formatted so that is shown correctly in iOS Calendar?

Hi

It looks to me like this is a bug:

The code is taking the whole URL and escaping anything that is not a valid character in the “host” part of the URL:

https://developer.apple.com/documentation/foundation/nscharacterset/1416426-urlhostallowedcharacterset?language=objc

I think the only sensible thing for this code to do is expect a validly formatted URL that it passes to the URLWithString method. If the string turns out not to be a valid URL then the result will be nil and perhaps the createEventAsync call can return a promise that resolves to an error to indicate that.

Otherwise if createEventAsync wants to do the escaping it would probably have to accept the parts of the URL and escape them as appropriate before constructing the full URL. e.g. (but of course irrelevant parts could be left out):

{
  scheme: "https",
  user: "johnny",
  password: "p4ssw0rd",
  host: "www.example.com",
  port: "443",
  pathComponents: ["/", "script.ext"],
  parameterString: "param=value",
  query: "query=value",
  fragment: "ref"
}

I think the first option makes more sense.

Could you create a new issue at https://github.com/expo/expo/issues?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.