Howdy, Stranger!

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

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Representation Download results in empty file

Hi!

When I click the download button for a representation in pawtucket I am prompted to save the file but on inspection the file is empty. As far as I can see the blobs in the database are fine. The files are PDFs.
Would be greatful for any advice!

Thanks, Marlies

Comments

  • Hi maja,

    Please look and see that the option download_version is set in your front-end detail.conf file.  PDFs should be downloaded as "original."
  • Thanks for the reply sophie.
    The only detail.conf file I could find was the one in my theme. In this file there was no entry download_version, and adding it didn't solve the problem.
    In media_display.conf I have the following setting:
    download = {
        pdf = {
            mimetypes = {application/pdf},
            display_version = original
        },
    ...


    Where is the content of the file loaded from? Is it the blob in the database?

    What I found out so far is that this line $vn_rc = $this->render('Details/object_representation_download_binary.php'); from the DetailController.php function DownloadRepresentation() returns empty. And also the 'version_path' or media path set above is empty.
    Is it supposed to be like this for PDFs?
  • Sorry I misspoke - the option is found in media_display.conf

    You should have a entry that looks like:

    pdf = {
    mimetypes = {application/pdf},
    display_version = tilepic,
    alt_display_version = mediumlarge,
    width = 400, height = 400,
    download_version = original,
    no_overlay = 0,
    viewer = UniversalViewer
    },
  • Had a look at it again, my media_display.conf file is different than yours.
    I have the version as it is in the master-fix branch of the git project (https://github.com/collectiveaccess/pawtucket2/blob/master-fix/app/conf/media_display.conf)

    Yet everything is set to original for pdf and I did not change things in the conf file so far.
    Is there really a problem with the configuration? As the PDF does download, but without any content.
  • Do they download incorrectly from the backend as well?
  • No, nothing happens when I download the representation in the back end. It simply redirects to an empty page.
    But the download in the back end is a media download (not a representation download), the links are different:

    Back end: editor/object_representations/ObjectRepresentationEditor/DownloadMedia/representation_id/12430/value_id//download/1/version/original
    Front end: Detail/DownloadRepresentation/representation_id/12430/object_id/10993/download/1/version/original

    There is also a media download button for the front end (Detail/DownloadMedia/object_id/10993/representation_id/12430/value_id//download/1/version/original). It results in the same empty page as in the back end.

    To test if the problem only occurs with PDFs I uploaded a picture and tried to download it. In the front end it downloaded fine, in the back end it didn't. I got an empty zip container.
  • I just noticed that if I down load an individual pdf (related representation bundle) it downloads correctly.  If I "Download all media associated with this..." it downloads a very large....but empty zip.

    Here's the file header:
    00000000h: 50 4B 03 04 14 00 08 00 08 00 B7 6E EB 4A 00 00 ; PK........·nëJ..

    which appears correct for a zip.
  • Has this problem been solved? I think I
    may be having the same problem in Providence 1.75.

    I search for “*” and then click on
    “Full Results” for objects.

    I then select the “Export Tools”
    icon and then try and use any “Download media as: “ options. The
    menu offers a zip file, and a credible file of unique data and size
    downloads.

    Any of my Windows or Ubuntu tools says
    the zip file is empty.

    One of my files is attached here. What am I doing wrong or how may I open it?

  • The 7-Zip utility is able to see and correctly extract the contents of my above example. It does complain, however, that the file has extra data after the end of the "payload".
    I examined one of these zipped files as a hexadecimal dump. I can see a number of "warnings" included at the end of the file. Here is a single line of such a warning:
    b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /var/www/html/CA/app/lib/core/Parsers/ZipStream.php:246) in <b>/var/www/html/CA/themes/default/views/bundles/download_file_binary.php</b> on line <b>29</b><br />
    I am guessing that these included warnings are what causes the zip file to be reported as empty in many archive utilities.
  • Hi Chris,
    No, I wasn't able to solve my problem. I bypassed it by adding an option to the code to directly download the original pdf used for the import instead of creating one from the generated pictures.
    Sorry I couldn't be of help.
    Greetings, Marlies
  • edited November 1
    I see the warnings on your ZIP file, but I don't get these warnings on our test systems. What version of PHP are you running?

    Also, try dropping the attached PHP file in place of the one in your install at app/lib/core/Parsers/ZipStream.php and let me know if that helps. (Obviously uncompress it first...)


    seth
  • Thanks for the support, Seth!

    My system is using PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
    Providence 1.75
    The new file didn't have any effect. The Windows extractor still says the file is empty, 7-Zip can extract it but reports the extra data (as before).

  • How are you running PHP? On Linux or Windows? As an Apache module? Or FCGI?
  • Sorry-
    I have a rented container with Ubuntu 16.04, PHP 7.0 and Apache 2. (LAMP)
    Any of the manual installs I have made with apt-get from the default repositories.
  • So is PHP running as an Apache module or FCGI? If you're not sure try running a script with a single line:

    <?php phpinfo(); ?>

    That will give you a rather complete list of configuration settings for your PHP install.
  • I am a layman trying to learn enough to get CA working for my group, so I will be ignorant of many common procedures.
    I don't remember installing Apache with much anything different than a default install. I thought PHP was independent of Apache.
    The attached file is the report from your script. That will explain more than I know about.
  • Hi,

    Can you load that script in your browser? We need phpinfo() to be run within the context of your web server rather than on the command line.

    thanks
    seth
  • edited November 2
    Sorry,
    I am learning as I go. The script through Apache reports the PHP is through the Apache 2.0 Handler
    I am starting to read about the different ways of handling PHP with Apache. My VPS has 2GB of RAM and is dedicated to only running my sub-domain. What is recommended?

    Also, I am trying to test FastCGI as an option. I was easily able to install FastCGI, with apt-get, but am stuck in setting it up in my Apache2.conf file.
    Below is the entry I am trying to prepare to enable FCGI in Apache2 (16.04)
    I have no clue of the exact directory path to use, and web searches don't don't seem to apply to my system.
    Would adding the text below make FastCGI work? What is this directory?
    ############
    LoadModule fcgid_module "/usr/lib/apache2/modules/mod_fcgid.so"
    <IfModule mod_fcgid.c>
      <Directory "<Path_To_Your_FCGI_application???UNKNOWN??>">
        SetHandler fcgid-script
        Order allow,deny
        Allow from all
      </Directory>
    </IfModule>
    ############
Sign In or Register to comment.