mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Fix IE Download
This commit is contained in:
@@ -57,20 +57,11 @@ class Printer implements ControllerProviderInterface
|
|||||||
}
|
}
|
||||||
$PDF = new PDFExport($printer->get_elements(), $layout);
|
$PDF = new PDFExport($printer->get_elements(), $layout);
|
||||||
|
|
||||||
/**
|
$response = new Response($PDF->render(), 200, array('Content-Type' => 'application/pdf'));
|
||||||
*
|
$response->headers->set('Pragma', 'public', true);
|
||||||
* Header "Pragma: public" SHOULD be present.
|
$response->setMaxAge(0);
|
||||||
* In case it is not present, download on IE 8 and previous over HTTPS
|
|
||||||
* will fail.
|
return $response;
|
||||||
*
|
|
||||||
* @todo : merge this shitty fix with Response object.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ( ! headers_sent()) {
|
|
||||||
header("Pragma: public");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Response($PDF->render(), 200, array('Content-Type' => 'application/pdf'));
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -792,25 +792,18 @@ class set_export extends set_abstract
|
|||||||
);
|
);
|
||||||
$response->headers->set('X-Sendfile', $file);
|
$response->headers->set('X-Sendfile', $file);
|
||||||
$response->headers->set('X-Accel-Redirect', $file_xaccel);
|
$response->headers->set('X-Accel-Redirect', $file_xaccel);
|
||||||
|
|
||||||
$response->headers->set('Pragma', 'public', true);
|
$response->headers->set('Pragma', 'public', true);
|
||||||
|
$response->setMaxAge(0);
|
||||||
|
|
||||||
$response->headers->set('Content-Type', $mime);
|
$response->headers->set('Content-Type', $mime);
|
||||||
$response->headers->set('Content-Length', filesize($file));
|
$response->headers->set('Content-Length', filesize($file));
|
||||||
$response->headers->set('Content-Disposition', $headerDisposition);
|
$response->headers->set('Content-Disposition', $headerDisposition);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
} else {
|
} else {
|
||||||
/**
|
$response->headers->set('Pragma', 'public', true);
|
||||||
*
|
$response->setMaxAge(0);
|
||||||
* Header "Pragma: public" SHOULD be present.
|
|
||||||
* In case it is not present, download on IE 8 and previous over HTTPS
|
|
||||||
* will fail.
|
|
||||||
*
|
|
||||||
* @todo : merge this shitty fix with Response object.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ( ! headers_sent()) {
|
|
||||||
header("Pragma: public");
|
|
||||||
}
|
|
||||||
|
|
||||||
$response->headers->set('Content-Type', $mime);
|
$response->headers->set('Content-Type', $mime);
|
||||||
$response->headers->set('Content-Length', filesize($file));
|
$response->headers->set('Content-Length', filesize($file));
|
||||||
|
@@ -9,10 +9,10 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function createApplication()
|
public function createApplication()
|
||||||
{
|
{
|
||||||
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
|
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
|
||||||
|
|
||||||
$app['debug'] = true;
|
$app['debug'] = true;
|
||||||
unset($app['exception_handler']);
|
unset($app['exception_handler']);
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +72,9 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->assertEquals("application/pdf", $response->headers->get("content-type"));
|
$this->assertEquals("application/pdf", $response->headers->get("content-type"));
|
||||||
|
|
||||||
$this->assertTrue($response->isOk());
|
$this->assertTrue($response->isOk());
|
||||||
|
$this->assertEquals(0, $response->getMaxAge());
|
||||||
|
$this->assertTrue($response->headers->has('pragma'));
|
||||||
|
$this->assertEquals('public', $response->headers->get('pragma'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user