cozy / cozy-calendar

An application to manage your events
https://demo.cozycloud.cc/#apps/calendar/
GNU Affero General Public License v3.0
66 stars 39 forks source link

No proper feedback when importing a malformed .ics #544

Open jsilvestre opened 8 years ago

jsilvestre commented 8 years ago

Steps to reproduce

        BEGIN:VCALENDAR
        VERSION:2.0
        PRODID:-//Cozy Cloud//NONSGML Cozy Agenda//EN
        BEGIN:VEVENT
        UID:26cfcfa5074253c3e71f8e39d90b3284
        DTSTAMP:20160404T214147Z
        DTSTART;TZID=UTC:20160503T190000
        DTEND;TZID=UTC:20160503T220000
        CREATED:20160404T214103Z
        LAST-MODIFIED:20160404T214147Z
        SUMMARY:random summary
        END:VEVENT
        END:VCALENDAR

A JS alert pops up saying "an error occured while importing your calendar" and in the network console we can see various errors:

> Failed to load resource: the server responded with a status of 500 (Internal Server Error) import_view.coffee:73
> SyntaxError: Unexpected token < in JSON at position 0(…) 
    $.ajax.error @ import_view.coffee:73
> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <meta name="description" content="Error 504: Ga
   .....

Expected result

A message is displayed in the app's UI, and it's not the 504 bad gateway one.