Skip to content

Commit 2a277ff

Browse files
committed
fix: Set origin when Contained Resource is Removed
Notification emitted on the container when a resource in it is removed, sets the `origin` property to the location of the removed resource, consistent with the requirements of `as:Remove`.
1 parent 6f4b22b commit 2a277ff

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/handlers/notify.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ function handler (req, res, next) {
9999
negotiatedFields
100100
) {
101101
const mediaType = negotiatedFields['content-type']
102+
const activity = getParentActivity(method, statusCode)
103+
const target = activity !== 'Update' ? String(fullUrl) : undefined
102104
if (ALLOWED_RDF_MIME_TYPES.includes(mediaType?.[0])) {
103105
return `${headerTemplate(negotiatedFields)}\r\n${solidRDFTemplate({
104-
activity: getParentActivity(method, statusCode),
106+
activity,
105107
eventID: parentID,
106108
date: eventDate,
107109
object: String(parentUrl),
108-
target: statusCode === 201 ? String(fullUrl) : undefined,
110+
target,
109111
eTag: undefined,
110112
mediaType
111113
})}`

test/integration/prep-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ solid:inserts { <u> <v> <z>. }.`
126126
expect(notification).to.haveOwnProperty('published')
127127
expect(notification.type).to.equal('Remove')
128128
expect(notification.object).to.match(/sampleContainer\/$/)
129+
expect(notification.origin).to.match(/sampleContainer\/.*example-prep.ttl$/)
129130
})
130131

131132
it('when resource is created by POST',

0 commit comments

Comments
 (0)