Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
af381a9a
Unverified
Commit
af381a9a
authored
4 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
remove unneeded if
Signed-off-by:
Robin Appelman
<
robin@icewind.nl
>
parent
2879472f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_sharing/lib/SharedStorage.php
+42
-44
42 additions, 44 deletions
apps/files_sharing/lib/SharedStorage.php
with
42 additions
and
44 deletions
apps/files_sharing/lib/SharedStorage.php
+
42
−
44
View file @
af381a9a
...
...
@@ -244,57 +244,55 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
}
public
function
fopen
(
$path
,
$mode
)
{
if
(
$source
=
$this
->
getUnjailedPath
(
$path
))
{
switch
(
$mode
)
{
case
'r+'
:
case
'rb+'
:
case
'w+'
:
case
'wb+'
:
case
'x+'
:
case
'xb+'
:
case
'a+'
:
case
'ab+'
:
case
'w'
:
case
'wb'
:
case
'x'
:
case
'xb'
:
case
'a'
:
case
'ab'
:
$creatable
=
$this
->
isCreatable
(
dirname
(
$path
));
$updatable
=
$this
->
isUpdatable
(
$path
);
// if neither permissions given, no need to continue
if
(
!
$creatable
&&
!
$updatable
)
{
if
(
pathinfo
(
$path
,
PATHINFO_EXTENSION
)
===
'part'
)
{
$updatable
=
$this
->
isUpdatable
(
dirname
(
$path
));
}
if
(
!
$updatable
)
{
return
false
;
}
$source
=
$this
->
getUnjailedPath
(
$path
);
switch
(
$mode
)
{
case
'r+'
:
case
'rb+'
:
case
'w+'
:
case
'wb+'
:
case
'x+'
:
case
'xb+'
:
case
'a+'
:
case
'ab+'
:
case
'w'
:
case
'wb'
:
case
'x'
:
case
'xb'
:
case
'a'
:
case
'ab'
:
$creatable
=
$this
->
isCreatable
(
dirname
(
$path
));
$updatable
=
$this
->
isUpdatable
(
$path
);
// if neither permissions given, no need to continue
if
(
!
$creatable
&&
!
$updatable
)
{
if
(
pathinfo
(
$path
,
PATHINFO_EXTENSION
)
===
'part'
)
{
$updatable
=
$this
->
isUpdatable
(
dirname
(
$path
));
}
$exists
=
$this
->
file_exists
(
$path
);
// if a file exists, updatable permissions are required
if
(
$exists
&&
!
$updatable
)
{
if
(
!
$updatable
)
{
return
false
;
}
}
// part file is allowed if !$creatable but the final file is $updatable
if
(
pathinfo
(
$path
,
PATHINFO_EXTENSION
)
!==
'part'
)
{
if
(
!
$exists
&&
!
$creatable
)
{
return
false
;
}
$exists
=
$this
->
file_exists
(
$path
);
// if a file exists, updatable permissions are required
if
(
$exists
&&
!
$updatable
)
{
return
false
;
}
// part file is allowed if !$creatable but the final file is $updatable
if
(
pathinfo
(
$path
,
PATHINFO_EXTENSION
)
!==
'part'
)
{
if
(
!
$exists
&&
!
$creatable
)
{
return
false
;
}
}
$info
=
[
'target'
=>
$this
->
getMountPoint
()
.
$path
,
'source'
=>
$source
,
'mode'
=>
$mode
,
];
\OCP\Util
::
emitHook
(
'\OC\Files\Storage\Shared'
,
'fopen'
,
$info
);
return
$this
->
nonMaskedStorage
->
fopen
(
$this
->
getUnjailedPath
(
$path
),
$mode
);
}
}
return
false
;
$info
=
[
'target'
=>
$this
->
getMountPoint
()
.
$path
,
'source'
=>
$source
,
'mode'
=>
$mode
,
];
\OCP\Util
::
emitHook
(
'\OC\Files\Storage\Shared'
,
'fopen'
,
$info
);
return
$this
->
nonMaskedStorage
->
fopen
(
$this
->
getUnjailedPath
(
$path
),
$mode
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment