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

Inline images in tickets expiring and not displaying

Hi Guys

We've noticed that when we respond to a ticket and include inline images, the images expire after a about a day or so. When we return to a ticket the images not longer display. Here is a sanitized sample URL to an image in a ticket that has expired images.

href="/file.php?key=XXXXXX&expires=1480464000&signature=XXXX&disposition=inline"

The expiry date (
1480464000) = Wed, 30 Nov 2016 00:00:00 GMT

If I open that link in my browser I get the following

"Unknown or invalid file"

So now when we open that ticket in the Agent area, the image is not displayed. We are using the S3 Plugin for storing images in S3.

What I have found is the following function is returning false when the expires time is less than NOW

File = /osticket/include/class.file.php

function verifySignature($signature, $expires) {
        $gmnow = Misc::gmtime();
       if ($expires < $gmnow)
        return false;

        $check = static::_genUrlSignature($this->getId(), $this->getKey(),
            $this->getSignature(), $expires);
        return $signature == $check;
    }

This function is called from /osticket/file.php

// 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);

    // Download the file..
    $file->download(@$_GET['disposition'] ?: false, $_GET['expires']);
}
// else
Http::response(404, __('Unknown or invalid file'));

What I'm trying to understand is why is an expires value set on an image url that seems to be stored statically in the ticket record in the database and then have a line in class.file.php that returns false if expires value is less than NOW.

My temporary fix for this at the moment is to simply comment out the following lines in class.file.php but I'm unsure what other issues that may cause.

// if ($expires < $gmnow)
//        return false;

Would appreciate some help in understanding this.

Thanks

Comments

  • Anybody have any idea on this one?
  • Please help us to help you by reading and following the posting guidelines located in this thread: Please read before requesting assistance.  The more information you give us the better we will be able to assist you. Thank you.


  • edited December 2016
    I thought my original description of the problem was pretty clear.

    Below is my install info if that's what you need.

    image


    I'm not seeing any php errors. Sending and receiving email and new tickets all work fine. Our install is on Ubuntu 14.04.5 LTS. The missing images are on both the client and staff side of the UI.

    Our site also uses the following theme http://themedost.com/shagen/

    Not sure what else to tell you.
  • I'm not aware of any "image" expiration procedures in osTicket.  So I really have no idea what you mean by your images are "expiring and not displaying"... Since you appear to be using a 3rd party theme mod I can only suggest that you remove it and see if your problems go away. Also 1.9.14 is old at this point.  It's one subversion version of of date for the 1.9 tree, and a major version out of date now that 1.10 is out. 
Sign In or Register to comment.