Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow falsy targets to be passed to the serializer #237

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rubensworks
Copy link

While updating rdflib from 0.12.x to 0.17.x in solid-permissions, I noticed that a bunch of unit tests in solid-permissions fail with the following error:

(node:12527) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'uri' of null
    at Object.serialize (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/node_modules/rdflib/lib/serialize.js:14:25)
    at Promise (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/src/permission-set.js:807:11)
    at new Promise (<anonymous>)
    at PermissionSet.serialize (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/src/permission-set.js:806:12)
    at Test.<anonymous> (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/test/unit/permission-set-test.js:245:13)
    at Test.bound [as _cb] (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/node_modules/tape/lib/test.js:76:32)
    at Test.run (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/node_modules/tape/lib/test.js:95:10)
    at Test.bound [as run] (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/node_modules/tape/lib/test.js:76:32)
    at Immediate.next [as _onImmediate] (/Users/rtaelman/Documents/UGent/nosync/solid/solid-permissions/node_modules/tape/lib/results.js:71:15)
    at runCallback (timers.js:810:20)

This crash occurs because the serialize.js assumes that target is defined, while solid-permissions sometimes passes null. Not sure who is at fault here, but in this PR I assume that rdflib should accept falsy target values.

With this change, all unit tests from solid-permissions pass on rdflib 0.17.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant