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
d625d8bd
Unverified
Commit
d625d8bd
authored
5 years ago
by
Roeland Jago Douma
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #17824 from nextcloud/fix/dav/catch_forbidden
Catch forbidden http status code
parents
6ad54f3f
c08e803d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/Files/Storage/DAV.php
+5
-0
5 additions, 0 deletions
lib/private/Files/Storage/DAV.php
with
5 additions
and
0 deletions
lib/private/Files/Storage/DAV.php
+
5
−
0
View file @
d625d8bd
...
@@ -35,6 +35,7 @@ namespace OC\Files\Storage;
...
@@ -35,6 +35,7 @@ namespace OC\Files\Storage;
use
Exception
;
use
Exception
;
use
GuzzleHttp\Exception\RequestException
;
use
GuzzleHttp\Exception\RequestException
;
use
OCP\Files\ForbiddenException
;
use
OCP\ILogger
;
use
OCP\ILogger
;
use
Psr\Http\Message\ResponseInterface
;
use
Psr\Http\Message\ResponseInterface
;
use
Icewind\Streams\CallbackWrapper
;
use
Icewind\Streams\CallbackWrapper
;
...
@@ -829,6 +830,7 @@ class DAV extends Common {
...
@@ -829,6 +830,7 @@ class DAV extends Common {
* when the authentication expired or is invalid
* when the authentication expired or is invalid
* @throws StorageNotAvailableException if the storage is not available,
* @throws StorageNotAvailableException if the storage is not available,
* which might be temporary
* which might be temporary
* @throws ForbiddenException if the action is not allowed
*/
*/
protected
function
convertException
(
Exception
$e
,
$path
=
''
)
{
protected
function
convertException
(
Exception
$e
,
$path
=
''
)
{
\OC
::
$server
->
getLogger
()
->
logException
(
$e
,
[
'app'
=>
'files_external'
,
'level'
=>
ILogger
::
DEBUG
]);
\OC
::
$server
->
getLogger
()
->
logException
(
$e
,
[
'app'
=>
'files_external'
,
'level'
=>
ILogger
::
DEBUG
]);
...
@@ -842,6 +844,9 @@ class DAV extends Common {
...
@@ -842,6 +844,9 @@ class DAV extends Common {
}
else
if
(
$e
->
getHttpStatus
()
===
Http
::
STATUS_METHOD_NOT_ALLOWED
)
{
}
else
if
(
$e
->
getHttpStatus
()
===
Http
::
STATUS_METHOD_NOT_ALLOWED
)
{
// ignore exception for MethodNotAllowed, false will be returned
// ignore exception for MethodNotAllowed, false will be returned
return
;
return
;
}
else
if
(
$e
->
getHttpStatus
()
===
Http
::
STATUS_FORBIDDEN
){
// The operation is forbidden. Fail somewhat gracefully
throw
new
ForbiddenException
(
get_class
(
$e
)
.
':'
.
$e
->
getMessage
());
}
}
throw
new
StorageNotAvailableException
(
get_class
(
$e
)
.
': '
.
$e
->
getMessage
());
throw
new
StorageNotAvailableException
(
get_class
(
$e
)
.
': '
.
$e
->
getMessage
());
}
else
if
(
$e
instanceof
ClientException
)
{
}
else
if
(
$e
instanceof
ClientException
)
{
...
...
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