We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22873
    • 9 Posts
    Hello,

    I’ve found strange behavior of static resources (2.1.0-rc3, friendly URLs on). I have added a new content type "PDF" with "application/pdf" MIME, ".pdf" extension and "binary" type. The PDF documents live in the "assets/documents" folder. I’ve set the "filemanager_path" system settings to "assets".

    I’ve uploaded a PDF file (let’s say "xyz.pdf") to the "assets/documents" directory without problems. Then I’ve created a static resource as a child of a normal document (the intend is to have downloadable PDF attachments of a normal document) with "xyz" URL alias. I’ve met the following problems with the static resource:

    1. I am not able to change the default "Basic Template" (with ID=1) to the (empty) template (ID=0) despite the fact it works nice for normal resources.

    2. If I use the MODX Browser to choose the "xyz.pdf" file, it puts "documents/xyz.pdf" path to the static resource content field. Such path does not work - I must always append "assets/" at the start manually.

    3. In a case the path is wrong (an incorrect file name for example), MODX returns an empty document with a correct mimetype, but with the status 200 OK (see the headers below).

    4. If the path is correct, MODX returns a correct PDF content (both as inline and attachement), but the URL has the ".html" extension. It is a bit annoying especially for downloading, because I must always rename the "xyz.html" to "xyz.pdf" manually.

    I cannot find, what I am doing wrong, or, alternatively, if there are some bugs here.
    Thanks in advance for any advice.

    Pavel

    FIY, the response headers, if the static resource has set a wrong path:
    Date: Fri, 15 Apr 2011 08:34:01 GMT
    Server: Apache/2.2.16 (Debian)
    X-Powered-By: PHP/5.3.3-7
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-Length: 0
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: application/pdf
    
    200 OK
      • 22873
      • 9 Posts
      So after some investigation:

      ad 1. Seems to be logged as bug #4369 already.

      ad 3. Logged as bug #4430.

      ad 4. Logged as bug #4429.