-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GEO field can break Google Calendar import #618
Comments
Hi, can you provide a minimalistic example that produces your No locationimport ical from 'ical-generator';
const cal = ical();
cal.createEvent({
summary: 'Test 1',
start: new Date(),
location: null
});
cal.toString();
With location.geo = null (invalid)import ical from 'ical-generator';
const cal = ical();
cal.createEvent({
summary: 'Test 1',
start: new Date(),
location: {
geo: null
}
});
cal.toString();
With location.geo.lat|lng = null (invalid)import ical from 'ical-generator';
const cal = ical();
cal.createEvent({
summary: 'Test 1',
start: new Date(),
location: {
geo: {
lat: null,
lng: null
}
}
});
cal.toString();
|
I currently don't have the codebase on hand, but if I'm not mistaken this was what I was passing in:
I can take a look tonight in the actual implementation at what it actually was if this doesn't turn out to reproduce the issue |
This also produces an error for me. So please have a look tonight or in the next few days. If it is a valid usage according to the API description, the output should of course also be valid and not import ical from 'ical-generator';
const cal = ical();
cal.createEvent({
summary: 'Test Event',
start: new Date(),
location: {
geo: {
lat: "undefined",
lng: "undefined"
}
}
});
cal.toString();
|
Just took a quick look at my exact code, because indeed your example throws the same error when I run it.
The documentation seems to mention there are two types for |
Okay, let's go through that one by one:
|
Interesting! Don't worry, I only write code in TypeScript but unfortunately in this codebase I don't have Now to make my codebase strict ;) |
## [8.0.1-develop.8](v8.0.1-develop.7...v8.0.1-develop.8) (2024-10-15) ### Bug Fixes * **Event:** Handle location.geo.lat|lon = null ([7e68f00](7e68f00)), closes [#618](#618)
🎉 This issue has been resolved in version 8.0.1-develop.8 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Thanks for the fix! I'm hoping this prevents other people from debugging huge iCal files that don't work in Google Calendar ;) |
🎉 This issue has been resolved in version 8.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I got a report from some of my customers that my calendar integration wasn't working for some people when they subscribed to my iCal feed in Google Calendar. The iCal file I generate validated correctly on a few of the online tools out there, and there were no issues when subscribing in Apple Calendar or Outlook. I started investigating (which meant cavemanning, Google Calendar doesn't exactly throw a stacktrace when the import goes wrong), and found Google Calendar breaks on this line of the
*.ics
fileical-generator
builds:Below demo calendar file is what you can use to validate my statement. If you go to Google Calendar, go to Settings and then import this file, you'll be greeted with a dialog saying Google Calendar can't import the events from the file.
I haven't read
RFC2445
yet to verify ifGEO:null;null
is a valid field yet, but as the validators seem to accept it either they are too lax, or Google is too strict in their implementation. Be that as it may: in the real world this results in a brokenics
file so I think we have to do something here.Easiest fix would be to omit the field if it's clearly empty (you can verify this, removing the line and importing the file works fine in Google Calendar), but I'm sure as to what you think is the best way forward?
I will patch this on my end for now, as I have clients waiting for a fix, but I'm happy to help implement a solution to mitigate this!
Edit: I was able to fix this fairly easily on my end by checking if the values I pass into
location.geo
actually exist. You could argue it's the developer responsibility to not pass in non-existing values, then again the library should not be able to generate invalidics
files either.The text was updated successfully, but these errors were encountered: