pydio / pydio-core

Pydio 8 official repository
https://pydio.com
GNU Affero General Public License v3.0
869 stars 289 forks source link

unable to download multiple files #1436

Open Trapulo opened 5 years ago

Trapulo commented 5 years ago

Hi, when I try to download multiple files, the Web GUI select them, shows the download button, but nothing happen. the browser's debug console reports a remote call with this response:

<?xml version="1.0" encoding="UTF-8"?>Malformed URL: D://MYLOGIN@/Websites/.............

where MYLOGIN is my users'name, and the path is the right path to the local file (of course, this is running on Windows).

Any idea?

thanks

achern commented 5 years ago

I am encountering the same bug on a new Pydio 8.2.1 install from archive on Windows Server 2012 R2 with IIS 8.5, PHP 7.2.9, and MySQL 8.0. Here is the error message when trying to access a zip download link:

<?xml version="1.0" encoding="UTF-8"?>
<tree >
    <message type="ERROR">Malformed URL: C://user1@/inetpub/wwwroot/pydio/data/files/sintex/folder</message>
</tree>

Looks like the user name is somehow getting into the file path to zip. Other similar reports here: https://forum.pydio.com/t/downloading-multiple-files/1444 https://forum.pydio.com/t/cannot-download-more-than-one-file-at-same-time/1636

achern commented 5 years ago

I did some debugging and I've narrowed the problem down to this newly added code to check permissions: https://github.com/pydio/pydio-core/commit/245161f7dedf0f1d5f2371d5d4c51b22a1a83fb1#diff-69ba9488ca49cd1d0c1167134a83b8e5R2443

Removing the newly added code makes folder and zip downloading work again.

I'm not familiar enough with pydio internals to figure out what the problem is, but here's a step-by-step trace to help pinpoint the issue (testuser is downloading testfolder from testworkspace):

2444    $topUrl = $selection->currentBaseUrl();                             // $topUrl is 'pydio://testuser@64c49a60024cc3bf8d7e36b24eeb17de'
2445    $realPath = MetaStreamWrapper::getRealFSReference($topUrl);         // $realPath is 'C:\inetpub\wwwroot\pydio\data\testworkspace'
2446    $newNode = new AJXP_Node(str_replace($realPath, $topUrl, $search)); // $search is 'C:/inetpub/wwwroot/pydio/data/testworkspace/testfolder', constructor argument is 'C:/inetpub/wwwroot/pydio/data/testworkspace/testfolder'
2447    $newNode->setUserId($ctx->getUser()->getId());                      // Throws error 'Malformed URL: C://testuser@/inetpub/wwwroot/pydio/data/testworkspace/testfolder'

Seems like maybe the workspace ID isn't making it into the URL.

Edit: took a closer look at it and it seems like the code is supposed to replace the workspace's filesystem path with a pydio workspace URL, but one of the string replace parameters is using Windows path separators while the other is using Linux/Unix ones, causing the replace to fail.

cdujeu commented 5 years ago

Hi @achern thanks for pointing out, we will have a look at that