derekantrican / GAS-ICS-Sync

A Google Apps Script for syncing ICS/ICAL files faster than the current Google Calendar speed
GNU General Public License v3.0
1.5k stars 192 forks source link

GoogleDrive & OneDrive - Error Incorrect ics/ical URL #412

Closed kurgompro closed 7 months ago

kurgompro commented 7 months ago

The problem

Since a couple of days, the GAS-ICS-Sync Script in my account stopped working for ICS files stored on Google Drive AND OneDrive. I get following error: [ERROR] Incorrect ics/ical URL

(a) I have updated the GAS-ICS-Sync Script to the latest version (5.8) on this page; (b) I tried following URL formats:

https://1drv.ms/u/s![FILE-ID] https://onedrive.live.com/embed?resid=[FILE-ID]&authkey=[AUTH-KEY] https://drive.google.com/uc?&id=[FILE-ID] https://drive.google.com/uc?export=view&id=[FILE-ID] https://drive.google.com/uc?export=download&id=[FILE-ID] https://drive.google.com/thumbnail?id=[FILE-ID] https://drive.google.com/thumbnail?id=[FILE-ID]&sz=w1000

These URL types have worked until a couple of days ago, but they have stopped working. Is this a known issue?

Version of GAS-ICS-Sync

5.8

Additional information & file uploads

No response

kurgompro commented 7 months ago

Addition: The issue is not related to the Outlook365 issue where 'END:VCALENDAR' and/or 'END:VEVENT' are missing (https://github.com/derekantrican/GAS-ICS-Sync/issues/388).

This issue seems to be related to the URL definition, given it's a working ICS of which the import works fine when putting on an FTP with absolute URL.

jonas0b1011001 commented 7 months ago

This does not sound like a script issue. If the URLs are not serving the expected ical data there's nothing we can do.

However, for GDrive you could get the files directly via the Drive Integration.

Adding something like

    const IDregex = /https:\/\/drive\.google\.com\/.*id=([^&]+).*/;
    if (IDregex.test(url)) {
      let id = IDregex.exec(url)[1];
      let icsString = DriveApp.getFileById(id).getBlob().getDataAsString();
      result.push([icsString, colorId]);
      continue;
    }

to https://github.com/derekantrican/GAS-ICS-Sync/blob/17cde1a768ad4c6d5ede0e7401e20606fff0be2a/Helpers.gs#L135 should work just fine.

kurgompro commented 7 months ago

@jonas0b1011001, Adding these lines of code actually helped perfectly, the ICS is now fetching again - Thanks a lot!

@derekantrican, Maybe good to add these few lines in the next version of GAS-ICS-Sync.

derekantrican commented 7 months ago

@kurgompro glad Jonas got you up & working. I don't think we'll incorporate these Google Drive lines into the main code as it's not an explicitly supported scenario. But you're welcome to post as a "show & tell" here: https://github.com/derekantrican/GAS-ICS-Sync/discussions/categories/show-and-tell

derekantrican commented 7 months ago

Closing as the problem seems to be solved