From 2d60dffd0d7653b58913385c7e811106f74fec1a Mon Sep 17 00:00:00 2001 From: bshuttle Date: Mon, 3 Jul 2006 15:07:15 +0000 Subject: [PATCH] handle missing documents gracefully. --- plugins/ktcore/KTDocumentActions.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/ktcore/KTDocumentActions.php b/plugins/ktcore/KTDocumentActions.php index 7a76364..69e5d94 100644 --- a/plugins/ktcore/KTDocumentActions.php +++ b/plugins/ktcore/KTDocumentActions.php @@ -72,10 +72,17 @@ class KTDocumentViewAction extends KTDocumentAction { if ($iVersion) { $oVersion = KTDocumentContentVersion::get($iVersion); $aOptions['version'] = sprintf("%d.%d", $oVersion->getMajorVersionNumber(), $oVersion->getMinorVersionNumber());; - $oStorage->downloadVersion($this->oDocument, $iVersion); + $res = $oStorage->downloadVersion($this->oDocument, $iVersion); } else { - $oStorage->download($this->oDocument); + $res = $oStorage->download($this->oDocument); } + + if ($res === false) { + $this->addErrorMessage(_kt('The file you requested is not available - please contact the system administrator if this is incorrect.')); + redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$this->oDocument->getId()))); + exit(0); + } + $oDocumentTransaction = & new DocumentTransaction($this->oDocument, "Document downloaded", 'ktcore.transactions.download', $aOptions); $oDocumentTransaction->create(); exit(0); -- libgit2 0.21.4