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

Fix for issue1957 sparql parser percent encoded reserved chars #1959

Merged
merged 8 commits into from May 25, 2022
Merged

Fix for issue1957 sparql parser percent encoded reserved chars #1959

merged 8 commits into from May 25, 2022

Conversation

ghost
Copy link

@ghost ghost commented May 19, 2022

Summary of changes

Seems like _hexExpand internal SPARQL parser function inappropriately expands percent-encoded reserved characters. Added an exclusionary regexp to disable this behaviour and a parameterized test which checks SPARQL parser processing of the set of percent-encoded reserved chars

Checklist

  • Checked that there aren't other open pull requests for the same change.
  • Added tests for any changes that have a runtime impact.
  • Checked that all tests and type checking passes.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

@ghost
Copy link
Author

ghost commented May 19, 2022

pre-commit.ci autofix

@coveralls
Copy link

coveralls commented May 19, 2022

Coverage Status

Coverage increased (+0.003%) to 88.44% when pulling 2c65fe1 on gjhiggins:fix-for-issue1957-sparql-parser-percent-encoded-reserved-chars into a3a4611 on RDFLib:master.

@ghost ghost self-requested a review May 19, 2022 18:50
There is no need to expand percentage encoded parts of PN_LOCAL, as they
should just be directly be used in the resulting IRI, and escaping them
just risks creating an invalid IRI.

Also:
- Move tests to `test/test_sparql/test_prefixed_name.py`
- Add some more general tests for prefixed names.
@aucampia
Copy link
Member

aucampia commented May 21, 2022

@gjhiggins made a commit on your branch:

Remove unnecessary hex expansion for PN_LOCAL in SPARQL parser

There is no need to expand percentage encoded parts of PN_LOCAL, as they
should just be directly be used in the resulting IRI, and expanding them
just risks creating an invalid IRI.

Also:

  • Move tests to test/test_sparql/test_prefixed_name.py
  • Add some more general tests for prefixed names.

Copy link
Member

@aucampia aucampia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good to have this fixed.

@aucampia aucampia requested a review from a team May 21, 2022 12:53
@aucampia aucampia added the review wanted This indicates that the PR is ready for review label May 21, 2022
@aucampia aucampia linked an issue May 21, 2022 that may be closed by this pull request
@aucampia aucampia merged commit 958b9a1 into RDFLib:master May 25, 2022
@ghost ghost deleted the fix-for-issue1957-sparql-parser-percent-encoded-reserved-chars branch May 26, 2022 10:04
@ghost ghost removed the review wanted This indicates that the PR is ready for review label Jun 4, 2022
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.

parseQuery decode the query string which cause invalid URI
2 participants