Skip to content

Make internal/quads unacceptable as output format - #316

Merged
jvherweg merged 2 commits into
masterfrom
weight0-preference
Nov 13, 2020
Merged

jvherweg merged 2 commits into
masterfrom
weight0-preference

Conversation

@jvherweg

@jvherweg jvherweg commented Nov 9, 2020

Copy link
Copy Markdown
Member

This closes #306 and closes #276 . It does not yet resolve the issue of making sure the patching store does not send quads back to the file store, but that should just be a config change after #297 is resolved.

I like how we can now reject content-types using weight 0, not a big fan of how there is now just a line always adding this preference in AcceptPreferenceParser, but it seemed like the best place to add it. Could also add an input parameter taking forbidden content-types into account but that seems a bit overkill.

@jvherweg jvherweg added the ☀️ enhancement New feature or request label Nov 9, 2020
Comment thread src/ldp/http/AcceptPreferenceParser.ts Resolved

@RubenVerborgh RubenVerborgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good work, just various nits.

Comment thread src/ldp/http/AcceptPreferenceParser.ts Outdated
Comment on lines +44 to +46
if (!result.type) {
result.type = [];
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The reason is I just added it there to make sure there is always an array to add the default preference to. But it is true that so far we have not clearly defined what the difference is between having an empty array and not having the preference field present at all.

@jvherweg

Copy link
Copy Markdown
Member Author

I rewrote the matchingTypes function to take into account that more specific media ranges override less specific ones. This means that internal/*;q=0 can be added as a default preference, but it will be ignored if more specific preferences such as internal/quads;q=1 get requested (and just to cover all bases the default preference only gets added if there is no preference value for internal/* in the input).

@RubenVerborgh

Copy link
Copy Markdown
Member

Excellent, thank you!

@RubenVerborgh
RubenVerborgh self-requested a review November 13, 2020 14:32
@jvherweg
jvherweg merged commit 715ba12 into master Nov 13, 2020

@RubenVerborgh RubenVerborgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perfect, let's merge.

@RubenVerborgh
RubenVerborgh deleted the weight0-preference branch November 13, 2020 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☀️ enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Have conditional data conversion Support */* Accept header for RDF data

3 participants