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

When there is no uri validation, do not validate the scheme #384

Merged
merged 4 commits into from
Jan 30, 2025

Conversation

imsdu
Copy link

@imsdu imsdu commented Jan 30, 2025

Fixes #383

The RdfDataset contains the invalid uri even if the scheme is wrong/missing if uri validation is disabled.

@filip26
Copy link
Owner

filip26 commented Jan 30, 2025

Thanks for the PR! Would it be possible to simply deprecate the uriValidation(true|false) option and introduce something like uriValidation(Policy.Full, Policy.SchemeOnly, Policy.None)? The motivation is to avoid introducing breaking changes for users currently relying on scheme-only validation with uriValidation(false) and to introduce the change transparently.

@imsdu
Copy link
Author

imsdu commented Jan 30, 2025

The PR is updated, introducing the policy as requested.
It introduces a bunch of deprecations so that no deprecated methods are used internally

@filip26 filip26 self-requested a review January 30, 2025 15:01
Copy link
Owner

@filip26 filip26 left a comment

Choose a reason for hiding this comment

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

I would like to bump the version to 1.5.0-SNAPSHOT before merging, but it seems I can't directly edit this PR to include the updated pom files.

if (uri == null
|| uri.length() < 3 // minimal form s(1):ssp(1)
public static final boolean isAbsoluteUri(final String uri, final UriValidationPolicy policy) {
boolean result = false;
Copy link
Owner

Choose a reason for hiding this comment

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

The validation status could be returned directly, i.e., by returning true or false without assigning the result to a variable. However, I'm not going to block this PR because of it.

* Method allowing to convert the legacy boolean to the matching policy
*/
public static UriValidationPolicy of(boolean value) {
if(value)
Copy link
Owner

Choose a reason for hiding this comment

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

To align with the code conventions used in the rest of the codebase, please use {} or the inline construct return _ ? _ : _ ;. Thank you!

@filip26 filip26 dismissed their stale review January 30, 2025 15:30

Version updated

@imsdu
Copy link
Author

imsdu commented Jan 30, 2025

I addressed the feedbacks, thanks for the help :)

@filip26 filip26 merged commit 984dc49 into filip26:main Jan 30, 2025
5 checks passed
@imsdu imsdu deleted the 383-disable-scheme-validation branch January 30, 2025 16:49
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.

Disabling uriValidation still validates the scheme and silently skips when the validation fails
2 participants