check if content file exists

This commit is contained in:
Uwe Steinmann 2022-09-08 16:43:29 +02:00
parent 4d5139fe82
commit d3294518ad

View File

@ -49,16 +49,19 @@ class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common {
*/ */
$this->params['content'] = $content; $this->params['content'] = $content;
if(null === $this->callHook('version')) { if(null === $this->callHook('version')) {
header("Content-Type: " . $content->getMimeType()); if(file_exists($dms->contentDir . $content->getPath())) {
$efilename = rawurlencode($content->getOriginalFileName()); header("Content-Type: " . $content->getMimeType());
if (!isset($settings->_viewOnlineFileTypes) || !is_array($settings->_viewOnlineFileTypes) || !in_array(strtolower($content->getFileType()), $settings->_viewOnlineFileTypes)) { $efilename = rawurlencode($content->getOriginalFileName());
header("Content-Disposition: attachment; filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename); if (!isset($settings->_viewOnlineFileTypes) || !is_array($settings->_viewOnlineFileTypes) || !in_array(strtolower($content->getFileType()), $settings->_viewOnlineFileTypes)) {
} else { header("Content-Disposition: attachment; filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename);
header("Content-Disposition: filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename); } else {
} header("Content-Disposition: filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename);
header("Cache-Control: must-revalidate"); }
header("Cache-Control: must-revalidate");
header("ETag: ".$content->getChecksum());
sendFile($dms->contentDir.$content->getPath()); sendFile($dms->contentDir.$content->getPath());
}
} }
break; break;
} }