Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
a3592534
Commit
a3592534
authored
Mar 26, 2015
by
Bjoern Schiessle
Browse files
always fall back to default share folder
parent
4c00be49
Changes
3
Hide whitespace changes
Inline
Side-by-side
apps/files_sharing/lib/helper.php
View file @
a3592534
...
...
@@ -283,8 +283,21 @@ class Helper {
*/
public
static
function
getShareFolder
()
{
$shareFolder
=
\
OC
::
$server
->
getConfig
()
->
getSystemValue
(
'share_folder'
,
'/'
);
$shareFolder
=
\
OC\Files\Filesystem
::
normalizePath
(
$shareFolder
);
if
(
!
\
OC\Files\Filesystem
::
file_exists
(
$shareFolder
))
{
$dir
=
''
;
$subdirs
=
explode
(
'/'
,
$shareFolder
);
foreach
(
$subdirs
as
$subdir
)
{
$dir
=
$dir
.
'/'
.
$subdir
;
if
(
!
\
OC\Files\Filesystem
::
is_dir
(
$dir
))
{
\
OC\Files\Filesystem
::
mkdir
(
$dir
);
}
}
}
return
$shareFolder
;
return
\
OC\Files\Filesystem
::
normalizePath
(
$shareFolder
);
}
/**
...
...
apps/files_sharing/lib/sharedmount.php
View file @
a3592534
...
...
@@ -50,8 +50,8 @@ class SharedMount extends MountPoint implements MoveableMount {
$mountPoint
=
basename
(
$share
[
'file_target'
]);
$parent
=
dirname
(
$share
[
'file_target'
]);
while
(
!
\
OC\Files\Filesystem
::
is_dir
(
$parent
))
{
$parent
=
dirname
(
$parent
);
if
(
!
\
OC\Files\Filesystem
::
is_dir
(
$parent
))
{
$parent
=
Helper
::
getShareFolder
(
);
}
$newMountPoint
=
\
OCA\Files_Sharing\Helper
::
generateUniqueTarget
(
...
...
apps/files_sharing/tests/helper.php
View file @
a3592534
...
...
@@ -52,9 +52,11 @@ class Test_Files_Sharing_Helper extends TestCase {
function
testSetGetShareFolder
()
{
$this
->
assertSame
(
'/'
,
\
OCA\Files_Sharing\Helper
::
getShareFolder
());
\
OCA\Files_Sharing\Helper
::
setShareFolder
(
'/Shared'
);
\
OCA\Files_Sharing\Helper
::
setShareFolder
(
'/Shared
/Folder
'
);
$this
->
assertSame
(
'/Shared'
,
\
OCA\Files_Sharing\Helper
::
getShareFolder
());
$sharedFolder
=
\
OCA\Files_Sharing\Helper
::
getShareFolder
();
$this
->
assertSame
(
'/Shared/Folder'
,
\
OCA\Files_Sharing\Helper
::
getShareFolder
());
$this
->
assertTrue
(
\
OC\Files\Filesystem
::
is_dir
(
$sharedFolder
));
// cleanup
\
OC
::
$server
->
getConfig
()
->
deleteSystemValue
(
'share_folder'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment