mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
PHRAS-315 Do not expose not downloadable subdef
This commit is contained in:
committed by
Benoît Burnichon
parent
9b6e20c6c5
commit
cd85d4fdf9
@@ -1019,6 +1019,17 @@ class V1Controller extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$databox = $record->getDatabox();
|
||||
try {
|
||||
$subDefDefinition = $databox->get_subdef_structure()->get_subdef($record->getType(), $media->get_name());
|
||||
} catch (\Exception_Databox_SubdefNotFound $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (false === $subDefDefinition->is_downloadable()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($media->get_permalink() instanceof \media_Permalink_Adapter) {
|
||||
$permalink = $this->listPermalink($media->get_permalink());
|
||||
} else {
|
||||
|
||||
@@ -1052,7 +1052,6 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase
|
||||
$embedTypes = array_flip(array_map(function($subdef) {return $subdef['name'];}, $content['response']['embed']));
|
||||
|
||||
//access to all subdefs
|
||||
$this->assertArrayHasKey('document', $embedTypes);
|
||||
$this->assertArrayHasKey('preview', $embedTypes);
|
||||
$this->assertArrayHasKey('thumbnail', $embedTypes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user