[gnome-calendar/mcatanzaro/add-calendar: 10/10] new-calendar-page: add support for webcal:// links



commit 8520e1819cdeb57f4d2cf5f5bda94f25d84e91c3
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Apr 1 21:45:54 2020 -0500

    new-calendar-page: add support for webcal:// links
    
    Turns out, all we have to do is rewrite the URL to https://. I'm
    surprised this works, but I don't see any problems with it. I tested
    subscribing to webcal://www.gnome.org/start/unstable/schedule.ics.
    
    See also: #481

 src/gui/calendar-management/gcal-new-calendar-page.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/gui/calendar-management/gcal-new-calendar-page.c 
b/src/gui/calendar-management/gcal-new-calendar-page.c
index ee784fff..da5656ff 100644
--- a/src/gui/calendar-management/gcal-new-calendar-page.c
+++ b/src/gui/calendar-management/gcal-new-calendar-page.c
@@ -356,6 +356,16 @@ validate_url_cb (gpointer data)
 
   if (uri != NULL && SOUP_URI_IS_VALID (uri))
     {
+      /* "Support" webcal:// links by converting them to https://. This works
+       * because WebDAV is an extension of HTTP, so we can treat it as normal
+       * HTTP.
+       *
+       * Note we don't allow hidden use of http://, since we want to protect the
+       * user from accidentally leaking calendars in the clear. Only https://.
+       */
+      if (strcmp (uri->scheme, "webcal") == 0)
+        soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTPS);
+
       discover_sources (self);
     }
   else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]