aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Notification
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-04-10 18:01:50 +0200
committerJoas Schilling <coding@schilljs.com>2024-04-12 10:30:39 +0200
commit874525425c0fd226f210001374b3c5681629436a (patch)
treeba56d0ea81bc70d26e18d0598762fa5df48426ab /lib/private/Notification
parent6545fed34ad8061c293f3975801eb4ff9eea10f2 (diff)
downloadnextcloud-server-874525425c0fd226f210001374b3c5681629436a.tar.gz
nextcloud-server-874525425c0fd226f210001374b3c5681629436a.zip
fix(notifications): Add a warning when using relative links
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Notification')
-rw-r--r--lib/private/Notification/Manager.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php
index d31de6f7950..5e7c888d4d9 100644
--- a/lib/private/Notification/Manager.php
+++ b/lib/private/Notification/Manager.php
@@ -376,6 +376,23 @@ class Manager implements IManager {
throw new IncompleteParsedNotificationException();
}
+ $link = $notification->getLink();
+ if ($link !== '' && !str_starts_with($link, 'http://') && !str_starts_with($link, 'https://')) {
+ $this->logger->warning('Link of notification is not an absolute URL and does not work in mobile and desktop clients [app: ' . $notification->getApp() . ', subject: ' . $notification->getSubject() . ']');
+ }
+
+ $icon = $notification->getIcon();
+ if ($icon !== '' && !str_starts_with($icon, 'http://') && !str_starts_with($icon, 'https://')) {
+ $this->logger->warning('Icon of notification is not an absolute URL and does not work in mobile and desktop clients [app: ' . $notification->getApp() . ', subject: ' . $notification->getSubject() . ']');
+ }
+
+ foreach ($notification->getParsedActions() as $action) {
+ $link = $action->getLink();
+ if ($link !== '' && !str_starts_with($link, 'http://') && !str_starts_with($link, 'https://')) {
+ $this->logger->warning('Link of action is not an absolute URL and does not work in mobile and desktop clients [app: ' . $notification->getApp() . ', subject: ' . $notification->getSubject() . ']');
+ }
+ }
+
return $notification;
}