添加 .ics 从 URL 到 Google 日历只显示 'busy'

Add .ics from URL to Google calendar only shows 'busy'

我正在开发一个 Web 应用程序,它在 Web 上动态分发多个 .ics 文件 space。所以现在我正在尝试从邮件客户端(如 macOS 日历应用程序、Outlook 或 Google 日历)观察那些 .ics 文件。除了 Google 日历:

之外,一切都非常完美

如果我尝试从 URL (here) I just get displayed 'busy' as subject for each event (example) 导入日历。这是一个奇怪的问题,因为它在所有其他应用程序中都像 charm 一样工作。如果我下载当前的 .ics 文件并静态导入它,它也能正常工作。 (所以这 不会 只是一个 .ics 内容问题)

好吧,我已经检查了几个相关的 issues/questions(见底部)但是 none 提供了一个 capable/correct 解决方案。

有趣的一提(最后一个相关问题让我想到了这个):

如果我将路径和名称重新排列为以下内容,有效

https://myurl.net/calendar.ics

如果我使用以下某些模式,它不起作用

https://myurl.net/ccalendar.ics
https://myurl.net/foo/calendar.ics

我也在 Google 的日历论坛中 post 解决了这个问题,但推荐给 post 这里的一些东西。

提前感谢您的帮助!

此致

相关:

尝试此 SO post 中提供的解决方案:

The calendar's URL that I provided GCal did not end in a filename (I use a PHP framework with URL rewriting). I updated the URL, appending "/calendar.ics" to it and subscribed to the URL in GCal, and now all events seem to display fine, showing all details.

经过一些实验后,我决定使用 google 上的 ICS validator。它显示 URLs 结果的 MIME-Type 可能配置错误(text/plain 应该是 text/calendar)。 我在访问 URL 之类的 https://myurl.net/foo/bar.ics 时已经注意到这一点,看到的是纯 .ics 文件内容,而不是下载此文件。这似乎取决于浏览器,一些浏览器会自动正确解释这种类型,但 Google 似乎不会。

但是:在我的应用程序 WEB-INF 中有一个名为 web.xml 的配置文件。我为以 *.ics:

结尾的文件手动定义了 MIME 类型
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
    ...     
    <mime-mapping>
        <extension>ics</extension>
        <mime-type>text/calendar</mime-type>
    </mime-mapping>
</web-app>

现在,即使 Google 日历也能识别独立于 URL 它分发的整个日历内容。

编辑:

好吧,经过严格的测试,所有日历都没有再出现问题,所以这似乎是我的解决方案。 Outlook、macOS 日历应用程序和 Mozilla Thunderbird 似乎 正确猜测 MIME 类型,Google 没有。