Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to request dav endpoint with POST request gives 500 Internal Server Error #38378

Closed
dpakach opened this issue Feb 4, 2021 · 3 comments
Assignees
Labels

Comments

@dpakach
Copy link
Contributor

dpakach commented Feb 4, 2021

Steps to reproduce

1.Try to do a dav request on webdav endpoint with POST request

curl http://localhost/remote.php/dav/files/admin/PARENT/parent.txt -u admin:admin  -v -XPOST 

Expected behaviour

Server should not throw any errors and give 501 Not Implemented since POST is not used in webDAV

Actual behaviour

It gives 500 Internal Server Error with response body

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>TypeError</s:exception>
  <s:message>explode() expects parameter 2 to be string, null given</s:message>
</d:error>

And server log

{
  "reqId": "qMZqVbFOTJlYJ7oT0zL4",
  "level": 4,
  "time": "2021-02-04T07:25:15+00:00",
  "remoteAddr": "127.0.0.1",
  "user": "admin",
  "app": "webdav",
  "method": "POST",
  "url": "/remote.php/dav/files/admin/PARENT/parent.txt",
  "message": "Exception: explode() expects parameter 2 to be string, null given: {\"Exception\":\"TypeError\",\"Message\":\"explode() expects parameter 2 to be string, null given\",\"Code\":0,\"Trace\":\"#0 \\/home\\/dipakacharya\\/www\\/core\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Browser\\/Plugin.php(160): explode()\\n#1 \\/home\\/dipakacharya\\/www\\/core\\/lib\\/composer\\/sabre\\/event\\/lib\\/WildcardEmitterTrait.php(89): Sabre\\\\DAV\\\\Browser\\\\Plugin->httpPOST()\\n#2 \\/home\\/dipakacharya\\/www\\/core\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Server.php(472): Sabre\\\\DAV\\\\Server->emit()\\n#3 \\/home\\/dipakacharya\\/www\\/core\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Server.php(253): Sabre\\\\DAV\\\\Server->invokeMethod()\\n#4 \\/home\\/dipakacharya\\/www\\/core\\/apps\\/dav\\/lib\\/Server.php(330): Sabre\\\\DAV\\\\Server->start()\\n#5 \\/home\\/dipakacharya\\/www\\/core\\/apps\\/dav\\/appinfo\\/v2\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#6 \\/home\\/dipakacharya\\/www\\/core\\/remote.php(165): require_once('\\/home\\/dipakacha...')\\n#7 {main}\",\"File\":\"\\/home\\/dipakacharya\\/www\\/core\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Browser\\/Plugin.php\",\"Line\":160}"

Server configuration

Operating system: ubuntu 20.04

Web server: apache2

Database: mysql

PHP version: 7.4

ownCloud version: (see ownCloud admin page) latest git master

Updated from an older ownCloud or fresh install: fresh

Where did you install ownCloud from: git

@dpakach
Copy link
Contributor Author

dpakach commented Feb 4, 2021

Another really strange thing, the server responds correctly when we send data with POST

❯ curl http://localhost/remote.php/dav/files/admin/PARENT/parent.txt -u admin:admin  -XPOST -d "HELLO" 
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotImplemented</s:exception>
  <s:message>There was no plugin in the system that was willing to handle this POST method.</s:message>
</d:error>

@phil-davis
Copy link
Contributor

phil-davis commented Feb 4, 2021

This looks like a sabre/dav issue. I raised sabre-io/dav#1324
And PR sabre-io/dav#1325 should fix it. When that is reviewed and released, we can bump the dependency in owncloud/core and re-test.

@phil-davis phil-davis self-assigned this Feb 4, 2021
@dpakach
Copy link
Contributor Author

dpakach commented Feb 15, 2021

Should be fixed not after the update in sabre

@dpakach dpakach closed this as completed Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants