We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    Since I upgraded to 2.0.7, I’ve noticed that when I upload a static resource to a sub folder (say, to my /assets folder), I’ve noticed that the path to the asset seems to get mangled in the Static Resource field.

    To reproduce this:
    1. I create a Static Resource
    2. then I upload a file to my /assets directory, say it’s named "test.pdf".
    3. The content type is PDF, binary.
    4. Save
    5. Preview the new Static resource

    Expected: A download of the PDF is triggered.
    Actual: 404 page

    My logs show this:
     [2011-01-20 23:59:02] (ERROR @ /index.php) Could not locate source file: /path/to/modx_doc_root/assetstest.pdf


    Note that the slash is missing from the path! It should read /path/to/modx_doc_root/assets/test.pdf

    I think this is a bug with the File Browser JS validation because the static resources I created before I upgraded to 2.0.7 show the correct path in the Static Resource dropdown field (i.e. the content field in the database), e.g. "assets/test.pdf". I’ve verified this in the database too... I can fix my paths by issuing MySQL statements like this:

    mysql> UPDATE modx_site_content SET content='assets/test.pdf' WHERE id=163 LIMIT 1;


    Then the static resource works as expected after I update the modx_site_content.content field. I can edit and save the Static Resource pages, the path just seems to come in wrong when I select the resource using the File Browser modal window.

    System Info
    MODx 2.0.7-pl (traditional)
    CentOS 5.5 (final)
    PHP 5.3.3
    MySQL 5.0.77

    Other System Settings:
    File Manager Path (filemanager_path): ’’ (blank)
    Is File Manager Path Relative? (filemanager_path_relative): Yes
    File Manager URL (filemanager_url): ’’ (blank)
    Is Filie Manager URL Relative? (filemanager_url_relative): Yes
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      I filed this as a bug... hope that was legit.
        • 13303
        • 3 Posts
        I can confirm this, just faced it today on a site i’m working on.

        When selecting a static resource (PDF) from the file browser it deletes a trailing slash. In my case my PDFs were located inside of assets/docs/

        but when saved, the path gets changed to assetsdocs/filename.pdf

        If anyone else has figured out a workaround, it would be appreciated.

          • 9207 ☆ A M B ☆
          • 2,475 Posts
          The workaround:

          Type in the path manually. You don’t have to rely on the file browser to supply the path.