nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.51k stars 4.08k forks source link

settings -> groupware: failed to load availability #36245

Closed patzm closed 3 months ago

patzm commented 1 year ago
could not load existing availability Error: invalid BYDAY value "-1SU&#13"
    BYDAY index.esm.js:11892
    _stringToData index.esm.js:11969
    fromICAL index.esm.js:6043
    _parseValue index.esm.js:7241
    _handleContentLine index.esm.js:7215
    i index.esm.js:6994
    _eachLine index.esm.js:7484
    i index.esm.js:6993
    x index.esm.js:14610
    n CalendarService.js:72
    u runtime.js:288
    _invoke runtime.js:262
    C runtime.js:83
    w logger.js:26
    i logger.js:26
    promise callback*w logger.js:26
    i logger.js:26
    promise callback*w logger.js:26
    i logger.js:26
    k logger.js:26
    k logger.js:26
    S CalendarService.js:48
    O CalendarService.js:48
    e Availability.vue:85
    u runtime.js:288
    _invoke runtime.js:262
    C runtime.js:83
    Y PreferenceService.js:43
    i PreferenceService.js:43
    H PreferenceService.js:43
    H PreferenceService.js:43
    mounted Availability.vue:83
    VueJS 4
    44435 settings-personal-availability.js:9
    Webpack 5
Availability.vue:98

and directly after that:

image

The fact that the original error relates to BYDAY, I suppose some birthday in one of my contacts is mal-formatted. Would be sad though if this breaks something in settings. If I assume correctly that BYDAY referres to birthday, then I would open another issue. If so, please feel free to hide my comments above and this one.

_Originally posted by @patzm in https://github.com/nextcloud/mail/issues/10331

patzm commented 1 year ago

maybe this is also relevant?

image logo not found ``` GEThttps://cloud.patz.app/apps/theming/image/logo?v=9 [HTTP/2 404 Not Found 126ms] GET https://cloud.patz.app/apps/theming/image/logo?v=9 Status 404 Not Found VersionHTTP/2 Transferred10,27 kB (23,73 kB size) Referrer Policystrict-origin Request PriorityLow cache-control no-cache, no-store, must-revalidate content-encoding gzip content-security-policy default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-WXBEMWVvSWdIQmZQQ0hnSG4rSkdWMGtJamk2QVJISWhnVWlUOFB3bzkyWT06TGZ1NEV1dERiMXl1UlJCZHhwVWxJRE40M0JmUGZCQk8xeVRXb3I1cXhqdz0=' blob:;style-src 'self' 'unsafe-inline';img-src 'self' data: blob: * https://*.tile.openstreetmap.org;font-src 'self' data:;connect-src 'self' blob: stun.nextcloud.com:443;media-src 'self' blob:;frame-src data: prezi.com player.vimeo.com vine.co www.youtube.com 'self';child-src 'self' blob:;frame-ancestors 'self';worker-src blob: 'self';form-action 'self' content-type text/html; charset=UTF-8 date Thu, 19 Jan 2023 14:54:38 GMT expires Thu, 19 Nov 1981 08:52:00 GMT feature-policy autoplay 'self';camera 'self';fullscreen 'self';geolocation 'self';microphone 'self';payment 'none' pragma no-cache referrer-policy strict-origin server nginx vary Accept-Encoding x-content-type-options nosniff x-download-options noopen X-Firefox-Spdy h2 x-frame-options SAMEORIGIN x-permitted-cross-domain-policies none x-request-id ZnKVtrFSCWIW5QyIdSXY x-robots-tag none x-robots-tag none x-xss-protection 1; mode=block Accept image/avif,image/webp,*/* Accept-Encoding gzip, deflate, br Accept-Language en-US,en;q=0.5 Connection keep-alive Cookie __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true; nc_username=martin; nc_token=rMGydM2AzPabxnpuR0IAgHLsJslk96jd; nc_session_id=aqr3dcc7fujb0aju3igthv3hv8; oc_sessionPassphrase=fdGJ1S9Mr4ygHPw53iPpF8DfKYrMrXMVst2IVykZpPqJzk%2FuFDwsHE8d%2BUtv5%2FdjKYHNO1ML0jkUUZjZVTPmoiYgVhL0w4tGX6d%2FZwAYKNFptulMTFD9lDIMrexk2VBz; oc11dnx5430h=aqr3dcc7fujb0aju3igthv3hv8 Host cloud.patz.app Referer https://cloud.patz.app/ Sec-Fetch-Dest image Sec-Fetch-Mode no-cors Sec-Fetch-Site same-origin TE trailers User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0 ```
szaimen commented 1 year ago

Hi, which NC version?

patzm commented 1 year ago

@miaulalala, you asked for network tab output. Is this what you were looking for?

image

@szaimen Nextcloud Hub 3 (25.0.1), stack is docker 🐳 compose: https://github.com/patzm/dockerfiles/tree/master/nextcloud

szaimen commented 1 year ago

Hi, can you try to upgrade to 25.0.3 first?

patzm commented 1 year ago

sadly not (or not easily), because @crazy-max doesn't provide the latest images yet from https://github.com/crazy-max/docker-nextcloud.

patzm commented 1 year ago

@szaimen I tried it now again with 25.0.3 after @crazy-max was so kind to release a new 🐳 docker image in crazy-max/docker-nextcloud#109. I still see the warning popping up. There are two errors in the console:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). content.js:1:13003

and

could not load existing availability Error: invalid BYDAY value "-1SU&#13"
    BYDAY index.esm.js:11892
    _stringToData index.esm.js:11969
    fromICAL index.esm.js:6043
    _parseValue index.esm.js:7241
    _handleContentLine index.esm.js:7215
    i index.esm.js:6994
    _eachLine index.esm.js:7484
    i index.esm.js:6993
    x index.esm.js:14610
    n CalendarService.js:72
    u runtime.js:288
    _invoke runtime.js:262
    C runtime.js:83
    w logger.js:26
    i logger.js:26
    promise callback*w logger.js:26
    i logger.js:26
    promise callback*w logger.js:26
    i logger.js:26
    k logger.js:26
    k logger.js:26
    S CalendarService.js:48
    O CalendarService.js:48
    e Availability.vue:85
    u runtime.js:288
    _invoke runtime.js:262
    C runtime.js:83
    Y PreferenceService.js:43
    i PreferenceService.js:43
    H PreferenceService.js:43
    H PreferenceService.js:43
    mounted Availability.vue:83
    VueJS 4
    44435 settings-personal-availability.js:9
    Webpack 5
Availability.vue:98
miaulalala commented 1 year ago

Ok looks like your VAVAILABLITIY is not encoded properly.

To determine where this is coming from, can you please anwer a couple questions?

1) Have you used the feature before? You can find a description and screenshots here: https://docs.nextcloud.com/server/latest/user_manual/en/groupware/calendar.html#availability-working-hours

2) Are you able to access the CalDAV url? You can copy the iOS/MacOS url in the calendar settings here: image

Paste it in your browser.

Then look for cal:calendar-home-set and click on the link: image

You will see a list of Nodes:

image

Click on inbox.

You should have an entry that is called cs:calendar-availability and should say something like this:

BEGIN:VCALENDAR PRODID:Nextcloud DAV app BEGIN:VTIMEZONE TZID:America/New_York BEGIN:STANDARD TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 DTSTART:19701101T020000 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD BEGIN:DAYLIGHT TZNAME:EDT TZOFFSETFROM:-0500 TZOFFSETTO:-0400 DTSTART:19700308T020000 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU END:DAYLIGHT END:VTIMEZONE BEGIN:VAVAILABILITY BEGIN:AVAILABLE DTSTART;TZID=America/New_York:20220321T090000 DTEND;TZID=America/New_York:20220321T170000 UID:7ab824d0-933d-4841-9b67-cf454806ab96 RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR END:AVAILABLE END:VAVAILABILITY END:VCALENDAR

Please copy- paste your cs:calendar-availability here :)

patzm commented 1 year ago
  1. no I haven't used this feature before. I use the NextCloud privately, so no use for that. image

  2. This doesn't work for me. My primary CalDAV address is https://cloud.patz.app/remote.php/dav, the iOS/macOS CalDAV is https://cloud.patz.app/remote.php/dav/principals/users/martin/. Both report the following text:

    This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

    Browsers: Firefox & Chrome.

miaulalala commented 1 year ago

Ah, my mistake - can you enable debug mode in your config.php? I think this will give you access.

patzm commented 1 year ago

😞 sorry I may not see it. I set

❯ grep loglevel config.php
  'loglevel' => 0,

but the website still shows the message that I pasted in https://github.com/nextcloud/server/issues/36245#issuecomment-1401641711. However, I checked that NextCloud picked up the new log level. The logfile now contains entries with "level": 0.

Did you maybe mean also enabling the admin_audit?

tomtjes commented 1 year ago

It's 'debug' => true, (Source)

I have the same problem on 25.0.3 (and it didn't work with prior versions either). My cs:calendar-availability:

BEGIN:VCALENDAR PRODID:Nextcloud DAV app BEGIN:VTIMEZONE TZID:America/New_York BEGIN:STANDARD TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 DTSTART:19701101T020000 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD BEGIN:DAYLIGHT TZNAME:EDT TZOFFSETFROM
miaulalala commented 1 year ago

It's 'debug' => true, (Source)

I have the same problem on 25.0.3 (and it didn't work with prior versions either). My cs:calendar-availability:

BEGIN:VCALENDAR PRODID:Nextcloud DAV app BEGIN:VTIMEZONE TZID:America/New_York BEGIN:STANDARD TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 DTSTART:19701101T020000 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD BEGIN:DAYLIGHT TZNAME:EDT TZOFFSETFROM

Is that all there is? Literally cut off in the middle of the VCALENDAR? :eyes:

tomtjes commented 1 year ago
Screen Shot 2023-02-17 at 15 35 33
patzm commented 1 year ago

Sorry for the late reply. I now did what was suggested in https://github.com/nextcloud/server/issues/36245#issuecomment-1425051904 and managed to get the information 🎉 (and thanks for the hint 😉 🙏 ).

The value of cs:calendar-availability is:

BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN PRODID:-//Apple Inc.//macOS 11.3.1//EN BEGIN:VTIMEZONE TZID:Europe/Berlin BEGIN:DAYLIGHT TZOFFSETFROM:+0100 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU DTSTART:19810329T020000 TZNAME:CEST TZOFFSETTO:+0200 END:DAYLIGHT BEGIN:STANDARD TZOFFSETFROM:+0200 RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU DTSTART:19961027T030000 TZNAME:CET TZOFFSETTO:+0100 END:STANDARD END:VTIMEZONE BEGIN:VAVAILABILITY UID:B01E420E-F2B9-4500-B734-D0C06BC1DB98 DTSTAMP:20211229T120947Z BEGIN:AVAILABLE UID:F353A2E5-8BB7-4193-B697-C49F03C82477 DTSTAMP:20211229T120947Z DTSTART;TZID=Europe/Berlin:20211129T080000 RRULE:FREQ=WEEKLY;BYDAY=WE,TH,FR,MO,TU DTEND;TZID=Europe/Berlin:20211129T180000 END:AVAILABLE END:VAVAILABILITY END:VCALENDAR 
joshtrichards commented 4 months ago

Are you still experiencing this in newer versions of Nextcloud?

tomtjes commented 4 months ago

Yes, I just checked yesterday after updating to the latest stable release.

miaulalala commented 3 months ago

Unfortunately, I can't reproduce your issue.

You could run this query:

DELETE FROM oc_properties WHERE userid = 'bob' and propertyname = '{urn:ietf:params:xml:ns:caldav}calendar-availability'; where bob is your username

to delete the broken VAVILABILITY data.

tomtjes commented 3 months ago

Thanks. I tried it but it doesn't help. Like before, I can set availability and get a confirmation upon hitting save. But when I come back to availability settings, I get an error: "Failed to load availability".

miaulalala commented 3 months ago

Can you share which settings you're trying to save?

tomtjes commented 3 months ago

After I delete the row with the above query, cs:calendar-availability is

BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN PRODID:-//Apple Inc.//Mac OS X 10.13.6//EN BEGIN:VTIMEZONE TZID:America/New_York BEGIN:DAYLIGHT TZOFFSETFROM:-0500 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU DTSTART:20070311T020000 TZNAME:EDT TZOFFSETT

I then go to https://DOMAIN/settings/user/availability and get a "failed to load availability error". I then set a random value, e.g. click the + next to Tuesday and set it to the default 9-5 and save, resulting in a "saved availability" banner.

At this point cs:calendar-availability is back at:

BEGIN:VCALENDAR PRODID:Nextcloud DAV app BEGIN:VTIMEZONE TZID:America/New_York BEGIN:STANDARD TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 DTSTART:19701101T020000 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD BEGIN:DAYLIGHT TZNAME:EDT TZOFFSETFROM

Somehow it gets cut off after 255 characters.

miaulalala commented 3 months ago

After I delete the row with the above query, cs:calendar-availability is

BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN PRODID:-//Apple Inc.//Mac OS X 10.13.6//EN BEGIN:VTIMEZONE TZID:America/New_York BEGIN:DAYLIGHT TZOFFSETFROM:-0500 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU DTSTART:20070311T020000 TZNAME:EDT TZOFFSETT

I then go to https://DOMAIN/settings/user/availability and get a "failed to load availability error". I then set a random value, e.g. click the + next to Tuesday and set it to the default 9-5 and save, resulting in a "saved availability" banner.

At this point cs:calendar-availability is back at:

BEGIN:VCALENDAR PRODID:Nextcloud DAV app BEGIN:VTIMEZONE TZID:America/New_York BEGIN:STANDARD TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 DTSTART:19701101T020000 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD BEGIN:DAYLIGHT TZNAME:EDT TZOFFSETFROM

Somehow it gets cut off after 255 characters.

Can you run DESCRIBE oc_properties; please and post the output?

tomtjes commented 3 months ago
DESCRIBE oc_properties;

propertyname    varchar(255)    NO              
propertyvalue   varchar(255)    NO      NULL        
id      bigint(20)  NO  PRI NULL    auto_increment  
propertypath    varchar(255)    NO  MUL NULL        
userid      varchar(64) YES MUL         
valuetype   smallint(6) YES     1       
miaulalala commented 3 months ago

Right, there's the issue - here is mine:

Field Type
id bigint
userid varchar(64)
propertypath varchar(255)
propertyname varchar(255)
propertyvalue longtext
valuetype smallint

What's your DB?

tomtjes commented 3 months ago

It's a MySQL database. Many years ago, I ran owncloud, not sure if that's relevant.

miaulalala commented 3 months ago

Weird - the migration is supposed to create a LONGTEXT field for you when migrating from the old OwnCloud dav_properties table.

You should be able to modify the column type with ALTER TABLE oc_properties MODIFY propertyvalue LONGTEXT; but I'm still weirded out that you don't have the correct type already.

Can you do a DESCRIBE on oc_appconfig please? That should also contain a LONGTEXT for the configvalue field.

tomtjes commented 3 months ago

That one looks correct.

DESCRIBE oc_appconfig;

appid   varchar(32) NO  PRI         
configkey   varchar(64) NO  PRI         
configvalue longtext    YES     NULL        
type    int(10) unsigned    NO      2       
lazy    smallint(5) unsigned    NO  MUL 0       
tomtjes commented 3 months ago

ALTER TABLE worked like a charm. Thank you so much for your help!

miaulalala commented 3 months ago

Glad it worked!