nextcloud / server

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

[Bug]: Calendar reminders not being sent if group name has special characters #41203

Open liddack opened 11 months ago

liddack commented 11 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

If I have a calendar shared with write-access with a group that has a name with special characters (like letters with diacritics) and set a reminder for an event in this calendar, the reminder notification is sent only for the user that created the event, and not for the group members.

Steps to reproduce

  1. Add the following line to the crontab of the www-data user: */1 * * * * php -f /var/www/nextcloud/occ dav:send-event-reminders
  2. Run the command sudo -u www-data php -f /var/www/nextcloud/occ config:app:set dav sendEventRemindersMode --value occ
  3. Log in with the admin user
  4. Create a group named Sócios
  5. Create two new users Socio1 and Socio2 and add them to the Sócios group
  6. Using two different browsers, login with each newly-created account
  7. Create a new calendar named Calendário Sócios and share it with the Sócios group with write-acess
  8. Create a new event named Evento Teste in the Calendário Sócios calendar for any future date
  9. Set a new Notification reminder for one minute from now
  10. Wait for the specified reminder time

Expected behavior

All of the Sócios group members should receive a notification for the reminder.

Instead, only the admin user receives a notification.

Installation method

Community Manual installation with Archive

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "10.20.31.154"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "version": "27.1.3.2",
        "dbtype": "mysql",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "installed": true,
        "default_language": "pt_BR",
        "default_locale": "pt_BR",
        "default_phone_region": "BR",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": 587,
        "mail_sendmailmode": "smtp",
        "overwrite.cli.url": "http:\/\/localhost",
        "htaccess.RewriteBase": "\/",
        "logtimezone": "America\/Santarem",
        "defaultapp": "files",
        "preview_ffmpeg_path": "\/usr\/bin\/ffmpeg",
        "maintenance": false,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "mysql.utf8mb4": true,
        "theme": "",
        "filesystem_check_changes": 1,
        "debug": false,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "allow_local_remote_servers": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "updater.secret": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 2
    }
}

List of activated Apps

Enabled:
  - activity: 2.19.0
  - calendar: 4.5.2
  - circles: 27.0.1
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contactsinteraction: 1.8.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - firstrunwizard: 2.16.0
  - impersonate: 1.14.0
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - nextcloud_announcements: 1.16.0
  - notifications: 2.15.0
  - oauth2: 1.15.1
  - password_policy: 1.17.0
  - photos: 2.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - support: 1.10.0
  - survey_client: 1.15.0
  - systemtags: 1.17.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - updatenotification: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - admin_audit: 1.17.0
  - bruteforcesettings: 2.7.0
  - encryption: 2.15.0
  - files_external: 1.19.0
  - suspicious_login: 5.0.0
  - twofactor_totp: 9.0.0
  - user_ldap: 1.17.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

[Log file too long, below is a link to pastebin]
https://pastebin.com/raw/Tmjrv7BA

Additional info

After debugging the server code, I discovered that the following line is where the bug happens:

https://github.com/nextcloud/server/blob/565dc36226d08d071c30d8ad4fd54126dfa4be79/apps/dav/lib/CalDAV/Reminder/ReminderService.php#L598

When a group is created with a name that has diacritics, the $gid field value is an urlencoded version of the group name (example: S%C3%B3cios).

If $this->groupManager->get($gid) is called with this value, it returns null.

However, if I create a second group called Socios and repeat steps 5-10 (only changing the group name to the newer one), the notifications are sent normally to all users.

kesselb commented 11 months ago

cc @nextcloud/groupware