mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
fix filename of attachment
This commit is contained in:
parent
56bd5c00e4
commit
ecb0258186
|
@ -1417,7 +1417,7 @@ class RestapiController { /* {{{ */
|
|||
return $response->withHeader('Content-Type', 'image/png')
|
||||
->withHeader('Content-Description', 'File Transfer')
|
||||
->withHeader('Content-Transfer-Encoding', 'binary')
|
||||
->withHeader('Content-Disposition', 'attachment; filename=preview-"' . $document->getID() . "-" . $object->getVersion() . "-" . $width . ".png" . '"')
|
||||
->withHeader('Content-Disposition', 'attachment; filename="preview-' . $document->getID() . "-" . $object->getVersion() . "-" . $width . ".png" . '"')
|
||||
->withHeader('Content-Length', $previewer->getFilesize($object))
|
||||
->withBody($stream);
|
||||
} else {
|
||||
|
@ -2597,7 +2597,7 @@ class TestController { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/* Middleware for authentication */
|
||||
class Auth { /* {{{ */
|
||||
class RestapiAuth { /* {{{ */
|
||||
|
||||
private $container;
|
||||
|
||||
|
@ -2619,7 +2619,17 @@ class Auth { /* {{{ */
|
|||
// $this->container has the DI
|
||||
$dms = $this->container->dms;
|
||||
$settings = $this->container->config;
|
||||
$logger = $this->container->logger;
|
||||
$logger = $this->container->logger;
|
||||
$userobj = null;
|
||||
if($this->container->has('userobj'))
|
||||
$userobj = $this->container->userobj;
|
||||
|
||||
if($userobj) {
|
||||
$response = $next($request, $response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
$logger->log("Invoke middleware for method ".$request->getMethod()." on '".$request->getUri()->getPath()."'", PEAR_LOG_INFO);
|
||||
$logger->log("Access with method ".$request->getMethod()." on '".$request->getUri()->getPath()."'".(isset($this->container->environment['HTTP_ORIGIN']) ? " with origin ".$this->container->environment['HTTP_ORIGIN'] : ''), PEAR_LOG_INFO);
|
||||
if($settings->_apiOrigin && isset($this->container->environment['HTTP_ORIGIN'])) {
|
||||
$logger->log("Checking origin", PEAR_LOG_DEBUG);
|
||||
|
@ -2698,7 +2708,16 @@ $container['logger'] = $logger;
|
|||
$container['fulltextservice'] = $fulltextservice;
|
||||
$container['notifier'] = $notifier;
|
||||
$container['authenticator'] = $authenticator;
|
||||
$app->add(new Auth($container));
|
||||
|
||||
$app->add(new RestapiAuth($container));
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['initRestAPI'])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['initRestAPI'] as $hookObj) {
|
||||
if (method_exists($hookObj, 'addMiddleware')) {
|
||||
$hookObj->addMiddleware($app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make CORS preflighted request possible
|
||||
$app->options('/{routes:.+}', function ($request, $response, $args) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user