files_mindmap icon indicating copy to clipboard operation
files_mindmap copied to clipboard

Open in Public Share Subfolder -> 404 Not Found

Open githubkoma opened this issue 5 years ago • 1 comments

Dear Team, many thanks for your great app!

I encountered the following error:

  • As logged in User,
    • i created a Public Share Folder, with write+upload permissions
      • created a mindmap called test1.km (*1)
    • created a subfolder, called "Workbench"
      • in that subfolder, i created a mindmap called test2.km (*2)
  • As public User
    • Opening (*1) works fine
    • Opening (*2): Mindmap editor opens, but throws an error modal: "Load file fail!File not found"

Extracting the 404 Error from the Developer Tools points me to the reqeust that works (*1) vs. the request that doesnt work (*2):

*1 works:

curl 'https://xyz.de/owncloud/apps/files_mindmap/public/Knz3RzeHYddBdKb?dir=%2F&filename=test1.km' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: https://xyz.de/owncloud/s/Knz3RzeHYddBdKb?path=%2F' -H 'requesttoken: 5BxxxxxxxxxxxxxbVXs=' -H 'OCS-APIREQUEST: true' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Cookie: oc_sessionPassphrase=X6xxxxxxxxxxxxxC4u; oclxxxxxn=8ffxxxxxxxvr8; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; guestUser=Gast' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'
{"writeable":true,"filecontents":"eyJyb290Ijp7ImRhdGEiOnsiaWQiOiJib3BtcTUzODEzMjgiLCJjcmVhdGVkIjoxNjExNTE0NTc1MzgwLCJ0ZXh0IjoiWmVudHJhbGVzIFRoZW1hIn0sImNoaWxkcmVuIjpbXX0sInRlbXBsYXRlIjoiZGVmYXVsdCIsInRoZW1lIjoiZnJlc2gtYmx1ZSIsInZlcnNpb24iOiIxLjQuNDMifQ==","mtime":1611563690,"mime":"application\/km"}

*2 doesnt work:

curl 'https://xyz.de/owncloud/apps/files_mindmap/public/Knz3RzeHYddBdKb?dir=%2FWorkbench&filename=test2.km' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: https://xyz.de/owncloud/s/Knz3RzeHYddBdKb?path=%2FWorkbench' -H 'requesttoken: 5B+3xxxxxxxxxxxXs=' -H 'OCS-APIREQUEST: true' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Cookie: oc_sessionPassphrase=X6xxxxxxxxxxC4u; oclxxxxxxx3n=8ffxxxxxxxvr8; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; guestUser=Gast' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'
{"message":"File not found"}

githubkoma avatar Jan 25 '21 08:01 githubkoma

From first glance a change in "PublicFileHandlingController.php" could help:

-             $fullpath = trim($dir.$filename);
+            $fullpath = trim($dir.'/'.$filename);

Just tested it out quickly, no Unit- or Integrationstests. (just because i need that public subfolder functionality right now..)

githubkoma avatar Jan 25 '21 09:01 githubkoma