We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14930
    • 70 Posts
    Quote from: sottwell at Aug 04, 2009, 05:25 AM

    It looks like the calculations for determining the path to use when creating the download links are not working correctly. I’ve run across servers that return odd stuff in the SERVER array causing MODx’s calculations to fail; it all depends on the server configuration.

    Thanks! Seems like I’ve just been having bad luck. Do you know if 1.0 handles this any differently? (I’m going to try it eventually, just thought I’d ask first.) I also tried one instance where MODx (same version as the others I’ve tested now) was installed under IIS, and that had the same problem too.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Ahuh. Just uploaded a zip file so I’d get the download option, and it’s doing the same thing (version 1.0.1 rev6515 from svn). Hmm.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 14930
        • 70 Posts
        Hmm. So you have the same bug? At least I’m not going crazy.. wink Do you have any ideas how to fix/get around this? Is the "Manage Files" thing something people don’t use, since if its such a relatively common bug, I haven’t really seen any talk about it? I just find it strange..

        I upgraded my test install to 1.0.0 rev 5601 and yeah, the problem’s still there.

        EDIT: Just to let you know a bit more: the site I’m working on has this sort of extranet where people can upload their own files. And then the people who manage the site could download the files straight from Manager, but unfortunately it doesn’t work. I think I’m going to have to come up with something else..
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The exact same URL loaded directly into the browser address bar works fine. Something odd here.

          Yes, I would suggest using something more like the FileUpload/FileDownload/FileDownload plugin trilogy for your purposes. If it’s just for an intranet and you trust your users you can skip the plugin.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 10487 MODX Staff
            • 1,535 Posts
            It would appear the same problem exists on Evo as well - I even get it on localhost sad Just having a quick look now for a fix
              Garry Nutting
              Senior Developer
              MODX, LLC

              Email: [email protected]
              Twitter: @garryn
              Web: modx.com
              • 10487 MODX Staff
              • 1,535 Posts
              OK, try this .... in manager/actions/files.dynamic.php:

              Search for this (should match around line 442):
              urlencode($webstart_path.substr($newpath, $len, strlen($newpath)))

              And, replace with this:
              $webstart_path.urlencode(substr($newpath, $len, strlen($newpath)))

              Does that work for you? That fixes it at my end.
                Garry Nutting
                Senior Developer
                MODX, LLC

                Email: [email protected]
                Twitter: @garryn
                Web: modx.com
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                That also fixed it for me. I spent a couple of hours trying one thing and another, but it never occurred to me to get rid of that!
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 14930
                  • 70 Posts
                  Thank you Garry! You just officially made my whole week! It works beautifully now!

                  (Man, it just blows me away every time how quickly you guys react to something like this.)
                    • 14930
                    • 70 Posts
                    The url is like this assets/files/extranet%2Ffilename.doc, so now it seems to replace the last / with %2F ? Oh wait, it did it before as well. Well, half of the problem (the extra part in the url) is solved smiley

                    And thanks again Garry and Susan for your help, it really means a lot to me.
                      • 10487 MODX Staff
                      • 1,535 Posts
                      OK, attempt 2 tongue Try this (same place to replace as before):
                      $webstart_path.implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath)))))


                      BTW, I’m tracking this in JIRA as MODX-1084.
                        Garry Nutting
                        Senior Developer
                        MODX, LLC

                        Email: [email protected]
                        Twitter: @garryn
                        Web: modx.com