From a382bc24435f27893599c60c0de38d05a03a4783 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 23 Apr 2015 11:06:59 -0500 Subject: [PATCH] oops: Fix crash navigating from user directory --- file.php | 13 +++++++++---- include/staff/ticket-view.inc.php | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/file.php b/file.php index 22cc8094b..fda45974e 100644 --- a/file.php +++ b/file.php @@ -29,11 +29,16 @@ if (!$_GET['key'] // Validate session access hash - we want to make sure the link is FRESH! // and the user has access to the parent ticket!! if ($file->verifySignature($_GET['signature'], $_GET['expires'])) { - if (($s = @$_GET['s']) && strpos($file->getType(), 'image/') === 0) - return $file->display($s); + try { + if (($s = @$_GET['s']) && strpos($file->getType(), 'image/') === 0) + return $file->display($s); - // Download the file.. - $file->download(@$_GET['disposition'] ?: false, $_GET['expires']); + // Download the file.. + $file->download(@$_GET['disposition'] ?: false, $_GET['expires']); + } + catch (Exception $x) { + Http::response(500, 'Unable to find that file: '.$ex->getMessage()); + } } // else Http::response(404, __('Unknown or invalid file')); diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 1bd831a38..fe5bfd04a 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -1010,5 +1010,5 @@ foreach (AttachmentFile::objects()->filter(array( 'filename' => $file->name, ); } ?> -$.showImagesInline(<?php echo JsonDataEncoder::encode($urls); ?>); +$('#ticket_thread').data('imageUrls', <?php echo JsonDataEncoder::encode($urls); ?>); </script> -- GitLab