{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/13878","labels_url":"https://api.github.com/repos/owncloud/core/issues/13878/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/13878/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/13878/events","html_url":"https://github.com/owncloud/core/issues/13878","id":56512500,"number":13878,"title":"Can not add files to root of the mount in a 2 level share situation","user":{"login":"nickvergessen","id":213943,"avatar_url":"https://avatars.githubusercontent.com/u/213943?v=3","gravatar_id":"","url":"https://api.github.com/users/nickvergessen","html_url":"https://github.com/nickvergessen","followers_url":"https://api.github.com/users/nickvergessen/followers","following_url":"https://api.github.com/users/nickvergessen/following{/other_user}","gists_url":"https://api.github.com/users/nickvergessen/gists{/gist_id}","starred_url":"https://api.github.com/users/nickvergessen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickvergessen/subscriptions","organizations_url":"https://api.github.com/users/nickvergessen/orgs","repos_url":"https://api.github.com/users/nickvergessen/repos","events_url":"https://api.github.com/users/nickvergessen/events{/privacy}","received_events_url":"https://api.github.com/users/nickvergessen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/core/labels/7.0-current","name":"7.0-current","color":"996633"},{"url":"https://api.github.com/repos/owncloud/core/labels/8.0-current","name":"8.0-current","color":"996633"},{"url":"https://api.github.com/repos/owncloud/core/labels/blue-ticket","name":"blue-ticket","color":"0033CC"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/29","labels_url":"https://api.github.com/repos/owncloud/core/milestones/29/labels","id":841322,"number":29,"title":"8.0-current","description":null,"creator":{"login":"craigpg","id":160667,"avatar_url":"https://avatars.githubusercontent.com/u/160667?v=3","gravatar_id":"","url":"https://api.github.com/users/craigpg","html_url":"https://github.com/craigpg","followers_url":"https://api.github.com/users/craigpg/followers","following_url":"https://api.github.com/users/craigpg/following{/other_user}","gists_url":"https://api.github.com/users/craigpg/gists{/gist_id}","starred_url":"https://api.github.com/users/craigpg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigpg/subscriptions","organizations_url":"https://api.github.com/users/craigpg/orgs","repos_url":"https://api.github.com/users/craigpg/repos","events_url":"https://api.github.com/users/craigpg/events{/privacy}","received_events_url":"https://api.github.com/users/craigpg/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":770,"state":"open","created_at":"2014-10-27T01:20:05Z","updated_at":"2015-02-04T14:01:24Z","due_on":"2015-01-02T22:00:00Z","closed_at":null},"comments":3,"created_at":"2015-02-04T11:02:33Z","updated_at":"2015-02-04T14:32:59Z","closed_at":"2015-02-04T13:55:40Z","body":"### Steps to reproduce\r\n1. Server1:\r\n    1. Create folder `root/` and share public with permissions\r\n    2. Add a folder `root/server1/` and two files `root/server1-1.txt` and `root/server1/server1-2.txt`\r\n    3. Visit public link and \"Add to owncloud\" on Server2\r\n\r\n2. Server2\r\n    1. Accept share from Server1, share mount public with permissions\r\n    2. Add a folder `root/server2/` and two files `root/server2-1.txt` and `root/server1/server2-2.txt`\r\n    3. Visit public link from Server2 and \"Add to owncloud\" on Server3\r\n\r\n3. Server3\r\n    1. Accept share from Server2\r\n    2. Add a folder and multiple files:\r\n        + `root/server1/server3-2.txt` :white_check_mark: (fixed on stable7 with #13796, master #13490)\r\n        + `root/server2/server3-3.txt` :white_check_mark:  (fixed on stable7 with #13796, master #13490)\r\n        + `root/server3-1.txt` :x:\r\n        + `root/server3/` :x:\r\n\r\n### Affected versions\r\n* master/stable8\r\n* stable7\r\n\r\n### Possible solution\r\nfrom @schiesbn https://github.com/owncloud/core/pull/13796#issuecomment-72705705\r\n> I think I found the problem. I did all de debugging on master, because it fails their too. \r\n>\r\n> We share a folder from server1 to server2 to server3. Now server3 wants to write a file to the folder. Since the folder is the root of the mount point on server2 the isCreatable()-check will lead us to this place https://github.com/owncloud/core/blob/master/lib/private/files/view.php#L90\r\nAt this point 'path' will be something like \"/user/files/mountpoint\" and \"fakeRoot\" will be \"/user/files/mountpoint/\" so strpos() will be false and we will return null which again will return false for the isCreatable()-check.\r\n>\r\n>My simple solution, I edited https://github.com/owncloud/core/blob/master/lib/private/files/view.php#L90 and adding following if-statement:\r\n>\r\n```\r\nif (rtrim($path,'/') === rtrim($this->fakeRoot, '/')) {\r\n    return '/';\r\n}\r\n```\r\n>\r\n> It works, all tests still pass. But I don't really feel comfortable... @icewind1991 what do you think?\r\n>\r\n> BTW: This is only 90% of the solution because for some reasons I'm able to create the first file successfully on server3 but if I try to create a second one I get a \"storage error\" and after that the mount point is gone. But still I think that the problem I outlined above is one of the important issues on the way to a solution.\r\n\r\n### Verified the \"possible solution\"\r\n- [x] master by @schiesbn \r\n- [x] stable7 by @nickvergessen"},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/72863403","html_url":"https://github.com/owncloud/core/issues/13878#issuecomment-72863403","issue_url":"https://api.github.com/repos/owncloud/core/issues/13878","id":72863403,"user":{"login":"MorrisJobke","id":245432,"avatar_url":"https://avatars.githubusercontent.com/u/245432?v=3","gravatar_id":"","url":"https://api.github.com/users/MorrisJobke","html_url":"https://github.com/MorrisJobke","followers_url":"https://api.github.com/users/MorrisJobke/followers","following_url":"https://api.github.com/users/MorrisJobke/following{/other_user}","gists_url":"https://api.github.com/users/MorrisJobke/gists{/gist_id}","starred_url":"https://api.github.com/users/MorrisJobke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MorrisJobke/subscriptions","organizations_url":"https://api.github.com/users/MorrisJobke/orgs","repos_url":"https://api.github.com/users/MorrisJobke/repos","events_url":"https://api.github.com/users/MorrisJobke/events{/privacy}","received_events_url":"https://api.github.com/users/MorrisJobke/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T14:32:59Z","updated_at":"2015-02-04T14:32:59Z","body":"Backport granted https://github.com/owncloud/core/pull/13888#issuecomment-72862298"}}