mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
Fix #1133 : Permalinks always expose the file extension of the original document
This commit is contained in:
@@ -152,7 +152,7 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
|
||||
$this->media_subdef->get_record_id(),
|
||||
$this->media_subdef->get_name(),
|
||||
$this->get_label(),
|
||||
pathinfo($this->media_subdef->get_record()->get_original_name(), PATHINFO_EXTENSION),
|
||||
pathinfo($this->media_subdef->get_file(), PATHINFO_EXTENSION),
|
||||
$this->get_token()
|
||||
);
|
||||
}
|
||||
|
@@ -54,12 +54,28 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
. static::$records['record_1']->get_sbas_id() . '/'
|
||||
. static::$records['record_1']->get_record_id()
|
||||
. '/document/' . static::$object->get_label()
|
||||
. '.' . pathinfo(static::$records['record_1']->get_original_name(), PATHINFO_EXTENSION)
|
||||
. '.' . pathinfo(static::$records['record_1']->get_subdef('document')->get_file(), PATHINFO_EXTENSION)
|
||||
. '?token=' . static::$object->get_token();
|
||||
|
||||
$this->assertEquals($url, static::$object->get_url($registry));
|
||||
}
|
||||
|
||||
public function testGet_Previewurl()
|
||||
{
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$previewPermalink = media_Permalink_Adapter::getPermalink($databox, static::$records['record_1']->get_subdef('preview'));
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$url = $registry->get('GV_ServerName') . 'permalink/v1/'
|
||||
. static::$records['record_1']->get_sbas_id() . '/'
|
||||
. static::$records['record_1']->get_record_id()
|
||||
. '/preview/' . $previewPermalink->get_label()
|
||||
. '.' . pathinfo(static::$records['record_1']->get_subdef('preview')->get_file(), PATHINFO_EXTENSION)
|
||||
. '?token=' . $previewPermalink->get_token();
|
||||
|
||||
$this->assertEquals($url, $previewPermalink->get_url($registry));
|
||||
}
|
||||
|
||||
public function testGet_page()
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
|
Reference in New Issue
Block a user