Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ public function execute($request)
$this->collection = QubitInformationObject::getById($this->getParameters['collection']);
}

if (isset($this->getParameters['mediatypes'])) {
$validMediaTypes = [
'audio' => QubitTerm::AUDIO_ID,
'image' => QubitTerm::IMAGE_ID,
'text' => QubitTerm::TEXT_ID,
'video' => QubitTerm::VIDEO_ID,
'other' => QubitTerm::OTHER_ID,
];
Comment on lines +137 to +143

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.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch! Defaulting to Other does make more sense than defaulting to text. Done!


if (false == array_search($this->getParameters['mediatypes'], $validMediaTypes)) {
$this->getParameters['mediatypes'] = QubitTerm::OTHER_ID;
}
}

// Set search realm if searching by repository
if (isset($request->repos) && ctype_digit($request->repos)) {
// Add repo to the user session as realm
Expand Down
5 changes: 5 additions & 0 deletions vendor/symfony/lib/request/sfWebRequest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,11 @@ public function setFormat($format, $mimeTypes)
*/
public function setRequestFormat($format)
{
$validFormats = array_keys($this->formats);

if (false === array_search($format, $validFormats)) {
$format = 'html';
}
$this->format = $format;
}

Expand Down
Loading