From 3fcce2e8a2ce5b7be83a1d16369dd56e0cf88f17 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Mon, 14 Sep 2026 11:10:15 +0200 Subject: [PATCH 1/2] notify-scripts: hash the object ids Signed-off-by: Simon L. --- Containers/nextcloud/notify-all.sh | 6 +++++- Containers/nextcloud/notify.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Containers/nextcloud/notify-all.sh b/Containers/nextcloud/notify-all.sh index 5f32bb47..27fd0892 100644 --- a/Containers/nextcloud/notify-all.sh +++ b/Containers/nextcloud/notify-all.sh @@ -13,6 +13,10 @@ fi SUBJECT="$1" MESSAGE="$2" +# The object-id is limited to 64 characters, so hash the subject to get a +# stable identifier of fixed length that is unique per subject. +OBJECT_ID="$(printf '%s' "$SUBJECT" | md5sum | cut -d ' ' -f1)" + if [ "$("${COMMAND[@]}" config:app:get notifications enabled)" = "no" ]; then echo "Cannot send notification as notification app is not enabled." exit 1 @@ -24,7 +28,7 @@ mapfile -t NC_USERS <<< "$NC_USERS" for user in "${NC_USERS[@]}" do echo "Posting '$SUBJECT' to: $user" - "${COMMAND[@]}" notification:generate "$user" "$NC_DOMAIN: $SUBJECT" -l "$MESSAGE" --object-type='update' --object-id="$SUBJECT" + "${COMMAND[@]}" notification:generate "$user" "$NC_DOMAIN: $SUBJECT" -l "$MESSAGE" --object-type='update' --object-id="$OBJECT_ID" done echo "Done!" diff --git a/Containers/nextcloud/notify.sh b/Containers/nextcloud/notify.sh index d540865e..094bb60a 100644 --- a/Containers/nextcloud/notify.sh +++ b/Containers/nextcloud/notify.sh @@ -13,6 +13,10 @@ fi SUBJECT="$1" MESSAGE="$2" +# The object-id is limited to 64 characters, so hash the subject to get a +# stable identifier of fixed length that is unique per subject. +OBJECT_ID="$(printf '%s' "$SUBJECT" | md5sum | cut -d ' ' -f1)" + if [ "$("${COMMAND[@]}" config:app:get notifications enabled)" = "no" ]; then echo "Cannot send notification as notification app is not enabled." exit 1 @@ -32,7 +36,7 @@ done for admin in "${NC_ADMIN_USER[@]}" do echo "Posting '$SUBJECT' to: $admin" - "${COMMAND[@]}" notification:generate "$admin" "$NC_DOMAIN: $SUBJECT" -l "$MESSAGE" --object-type='update' --object-id="$SUBJECT" + "${COMMAND[@]}" notification:generate "$admin" "$NC_DOMAIN: $SUBJECT" -l "$MESSAGE" --object-type='update' --object-id="$OBJECT_ID" done echo "Done!" From 70d38607ccd640c2d215716058821feb3516516a Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Mon, 14 Sep 2026 12:40:55 +0200 Subject: [PATCH 2/2] adjust logic to use sha256sum instead Signed-off-by: Simon L. --- Containers/nextcloud/notify-all.sh | 2 +- Containers/nextcloud/notify.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Containers/nextcloud/notify-all.sh b/Containers/nextcloud/notify-all.sh index 27fd0892..00b3ce9b 100644 --- a/Containers/nextcloud/notify-all.sh +++ b/Containers/nextcloud/notify-all.sh @@ -15,7 +15,7 @@ MESSAGE="$2" # The object-id is limited to 64 characters, so hash the subject to get a # stable identifier of fixed length that is unique per subject. -OBJECT_ID="$(printf '%s' "$SUBJECT" | md5sum | cut -d ' ' -f1)" +OBJECT_ID="$(printf '%s' "$SUBJECT" | sha256sum | cut -c1-64)" if [ "$("${COMMAND[@]}" config:app:get notifications enabled)" = "no" ]; then echo "Cannot send notification as notification app is not enabled." diff --git a/Containers/nextcloud/notify.sh b/Containers/nextcloud/notify.sh index 094bb60a..c94ed2ae 100644 --- a/Containers/nextcloud/notify.sh +++ b/Containers/nextcloud/notify.sh @@ -15,7 +15,7 @@ MESSAGE="$2" # The object-id is limited to 64 characters, so hash the subject to get a # stable identifier of fixed length that is unique per subject. -OBJECT_ID="$(printf '%s' "$SUBJECT" | md5sum | cut -d ' ' -f1)" +OBJECT_ID="$(printf '%s' "$SUBJECT" | sha256sum | cut -c1-64)" if [ "$("${COMMAND[@]}" config:app:get notifications enabled)" = "no" ]; then echo "Cannot send notification as notification app is not enabled."