Fix several bugs preventing file downloads

This is a regression introduced somewhere along the way in the new storage API system for osTicket.