Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Attachments are not loaded and it just shows a blank page

Hi,

just updated from version 1.9.4 to 1.9.5.1

Every time I am trying to open an attachment, it just ends up showing a "blank" page. Nothing on it.

Here is my System Info:

Server Information
osTicket Version v1.9.5.1 (1faad22)
Web Server Software Apache/2.2.22 (Debian)
MySQL Version 5.5.38
PHP Version 5.5.20-1~dotdeb.1
PHP Extensions
gdlib Used for image manipulation and PDF printing
imap Used for email fetching
xml XML API
xml-dom Used for HTML email processing
json Improves performance creating and processing JSON
mbstring Highly recommended for non western european language content
phar Highly recommended for plugins and language packs
fileinfo Used to detect file types for uploads
PHP Settings
cgi.fix_pathinfo "1" is recommended if AJAX is not working
date.timezone Europe/Berlin
Database Information and Usage
Schema ticketsystem (localhost)
Schema Signature b26f29a6bb5dbb3510b057632182d138
Space Used 5144.07 MiB
Space for Attachments 4514.20 MiB

Everything else is working fine.

Any idea what could be the reason???
Tagged:

Comments

  • What i figured out is, that the problem comes from the "class.thread.php" file.

    I copyed this part from version 1.9.4 and now it works again:

        function getAttachments() {

            if($this->attachments)
                return $this->attachments;

            //XXX: inner join the file table instead?
            $sql='SELECT a.attach_id, f.id as file_id, f.size, lower(f.`key`) as file_hash, f.name, a.inline '
                .' FROM '.FILE_TABLE.' f '
                .' INNER JOIN '.TICKET_ATTACHMENT_TABLE.' a ON(f.id=a.file_id) '
                .' WHERE a.ticket_id='.db_input($this->getTicketId())
                .' AND a.ref_id='.db_input($this->getId());

            $this->attachments = array();
            if(($res=db_query($sql)) && db_num_rows($res)) {
                while($rec=db_fetch_array($res))
                    $this->attachments[] = $rec;
            }

            return $this->attachments;
        }

        function getAttachmentUrls($script='image.php') {
            $json = array();
            foreach ($this->getAttachments() as $att) {
                $json[$att['file_hash']] = array(
                    'download_url' => sprintf('attachment.php?id=%d&h=%s', $att['attach_id'],
                        strtolower(md5($att['file_id'].session_id().$att['file_hash']))),
                    'filename' => $att['name'],
                );
            }
            return $json;
        }

        function getAttachmentsLinks($file='attachment.php', $target='', $separator=' ') {

            $str='';
            foreach($this->getAttachments() as $attachment ) {
                if ($attachment['inline'])
                    continue;
                /* The hash can be changed  but must match validation in @file */
                $hash=md5($attachment['file_id'].session_id().$attachment['file_hash']);
                $size = '';
                if($attachment['size'])
                    $size=sprintf('<em>(%s)</em>', Format::file_size($attachment['size']));

                $str.=sprintf('<a class="Icon file no-pjax" href="%s?id=%d&h=%s" target="_blank" target="%s">%s</a>%s&nbsp;%s',
                        $file, $attachment['attach_id'], $hash, $target, Format::htmlchars($attachment['name']), $size, $separator);
            }

            return $str;


    Any idea why it doesnt work with the code in version 1.9.5.1???
  • Are you sure that you are running 1.9.5.1?
    https://github.com/osTicket/osTicket-1.8/releases/tag/v1.9.5.1

    Because that sounds a lot like the first two things mentioned on this list:
    • Fix file.php to serve files added to system before osTicket v1.9.1
    • Fix file.php to serve files if client panel or system is offline
    • Fix popover download of inline images
    • Avoid de-duplicating zero-length files
    • Send new message alert to team members if not assigned to an agent
    • Fix import of users to organization not setting the organization
    • Fix redactor toolbar showing over the date picker (#1450, thanks @Chefkeks)

  • Yes, I downloaded the version 1.9.5.1 from your website... it also shows in the OS Ticket that this version is installed. All files in the upload folder where uploaded to the server.

    Could it have to do anything with the database?

    In 1.9.4 everything was running without any problems. From 1.9.4 i upgraded directly to 1.9.5.1

    I dont think it is necessary to first upgrade to 1.9.5 ? Because according to my understanding the database in this case is not touched... only the files...?
  • I'd check the PHP error log, or enable error display. And see if there are any errors.

    Here are some instructions on how to turn on Error display if you want to do that.
    Q: How do I turn on error displaying for osTicket?
    http://tmib.net/osticket-v19x-frequently-asked-questions-faq#2

  • Additionally it should be mentioned that only the files changed form 1.9.4 to 1.9.5.1 - so no database upgrade.
  • edited January 2015
    I am also having the same issue.  Unable to view pdf files in vs 1.9.5.1 that I was just a couple of days before able to view in 1.9.4.

    I just re-downloaded 1.9.5.1 to make sure I indeed have the latest version and the issue persists.  I tried solution recommended by AR84  above, but that did not work for me.
Sign In or Register to comment.