File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5656 die ();
5757 }
5858} else {
59+ $ shareManager = \OC ::$ server ->getShareManager ();
60+ $ share = $ shareManager ->getShareByToken ((string )$ _POST ['dirToken ' ]);
61+
5962 // TODO: ideally this code should be in files_sharing/ajax/upload.php
6063 // and the upload/file transfer code needs to be refactored into a utility method
6164 // that could be used there
6265
6366 \OC_User::setIncognitoMode (true );
6467
65- $ publicDirectory = !empty ($ _POST ['subdir ' ]) ? (string )$ _POST ['subdir ' ] : '/ ' ;
68+ // If it is a write-only folder no subdirectory can be specified
69+ $ publicDirectory = '' ;
70+ if ($ share ->getPermissions () & \OCP \Constants::PERMISSION_READ ) {
71+ $ publicDirectory = !empty ($ _POST ['subdir ' ]) ? (string )$ _POST ['subdir ' ] : '/ ' ;
72+ } else {
73+ $ _POST ['file_directory ' ] = '' ;
74+ }
6675
6776 $ linkItem = OCP \Share::getShareByToken ((string )$ _POST ['dirToken ' ]);
6877 if ($ linkItem === false ) {
165174
166175 if (isset ($ _POST ['dirToken ' ])) {
167176 // If it is a read only share the resolution will always be autorename
168- $ shareManager = \OC ::$ server ->getShareManager ();
169- $ share = $ shareManager ->getShareByToken ((string )$ _POST ['dirToken ' ]);
170177 if (!($ share ->getPermissions () & \OCP \Constants::PERMISSION_READ )) {
171178 $ resolution = 'autorename ' ;
172179 }
You can’t perform that action at this time.
0 commit comments