Add digital object type params and sf_format check - #2385
Open
anvit wants to merge 2 commits into
Open
Conversation
Add a check for digital object type params and sf_format and assume safe defaults in case on invalid values.
sbreker
approved these changes
Jul 10, 2026
sevein
reviewed
Jul 23, 2026
Comment on lines
+137
to
+142
| $validMediaTypes = [ | ||
| 'audio' => QubitTerm::AUDIO_ID, | ||
| 'image' => QubitTerm::IMAGE_ID, | ||
| 'text' => QubitTerm::TEXT_ID, | ||
| 'video' => QubitTerm::VIDEO_ID, | ||
| ]; |
Member
There was a problem hiding this comment.
Could we add 'other' => QubitTerm::OTHER_ID to this list? When a user selects "Other" the request sends mediatypes=139. This list does not include 139, so the code changes it to Image and shows the wrong results, right?
Contributor
Author
There was a problem hiding this comment.
Ah, good catch! Defaulting to Other does make more sense than defaulting to text. Done!
Comment on lines
+743
to
+747
| $validFormats = ['xml', 'ead', 'dc', 'csv', 'html', 'json']; | ||
|
|
||
| if (false === array_search($format, $validFormats)) { | ||
| $format = 'html'; | ||
| } |
Member
There was a problem hiding this comment.
This is blocking formats already registered in $this->formats. For example, txt is registered by Symfony, but this code changes it to html. Is this intentional? Maybe we can also accept the registered formats and use html only for values that are not known?
Update the default media type in case of invalid media types to be 'Other'. Also use the existing list for formats for sfWebRequest instead of defining one just for the function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a check for digital object type params and sf_format and assume safe defaults in case on invalid values.