Setting quota via curl not working
mrAceT opened this issue · 8 comments
I have a clean install of NextCloud on CentOS 8 with PHP 7.4
All is working well, I installed the 'groupquota' plugin and I am able to set the group quota via occ and I am able to read the goupquota via curl. But setting the groupquota via curl does not work (following the instructions offcource)
What output do you get from the curl command (if any)
If the response is empty try adding -i
to get the response headers
Ik get the exact same response as without setting a different quota.. it simply doesn't listen
#curl -u admin:XXXX -H 'OCS-APIRequest: true' https://YYYY/apps/groupquota/quota/zzzz -X POST -d 'quota=1GB'
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message>OK</message>
<totalitems></totalitems>
<itemsperpage></itemsperpage>
</meta>
<data>
<quota_bytes>2147483648</quota_bytes>
<quota_human>2 GB</quota_human>
<used_bytes>33584702</used_bytes>
<used_human>32 MB</used_human>
<used_relative>1.56</used_relative>
</data>
</ocs>
Excuse me, with the "-i" option:
# curl -u XXX:YYY -i -H 'OCS-APIRequest: true' https://ZZZ/apps/groupquota/quota/xxx-X POST -d 'quota=1GB'
HTTP/2 404
date: Fri, 02 Apr 2021 08:32:24 GMT
server: Apache/2.4.37 (centos) OpenSSL/1.1.1g
x-powered-by: PHP/7.4.16
expires: Thu, 19 Nov 1981 08:52:00 GMT
pragma: no-cache
cache-control: no-cache, no-store, must-revalidate
content-security-policy: default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
feature-policy: autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'
x-robots-tag: none
set-cookie: oc_sessionPassphrase=NxxxipkpKFFRp%2BvovujkP0HZ29rzZuWfzU2hITYVKZ2rkS8H9%2zzzRHtZRGUx0D2mx; path=/; secure; HttpOnly; SameSite=Lax
set-cookie: __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
set-cookie: __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
set-cookie: oXXXw3=hdsoi7nfbZZZqd8; path=/; secure; HttpOnly; SameSite=Lax
set-cookie: cookie_test=test; expires=Fri, 02-Apr-2021 09:32:25 GMT; Max-Age=3600
strict-transport-security: max-age=63072000; includeSubDomains
content-length: 389
content-security-policy: default-src https:; connect-src https:; font-src https: data:; frame-src https:; img-src https: data: blob:; media-src https:; object-src https:; script-src 'unsafe-inline' 'unsafe-eval' https:; style-src 'unsafe-inline' https:; frame-ancestors 'self'
content-type: application/xml; charset=utf-8
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message>OK</message>
<totalitems></totalitems>
<itemsperpage></itemsperpage>
</meta>
<data>
<quota_bytes>2147483648</quota_bytes>
<quota_human>2 GB</quota_human>
<used_bytes>50500942</used_bytes>
<used_human>48.2 MB</used_human>
<used_relative>2.35</used_relative>
</data>
</ocs>
Hmmmm, I see "404" !?
same problem as here. setting the quota via api does not work.
the route to set the quota does not work. the call keeps getting to the getQuota method in the controller. simple workaround:
change this
return [ 'routes' => [ ['name' => 'Quota#setQuota', 'url' => '/quota/{groupId}', 'verb' => 'PUT'], ['name' => 'Quota#getQuota', 'url' => '/quota/{groupId}', 'verb' => 'GET'], ], ];
to
return [ 'ocs' => [ ['name' => 'Quota#setQuota', 'url' => '/quota/{groupId}', 'verb' => 'PUT'], ['name' => 'Quota#getQuota', 'url' => '/quota/{groupId}', 'verb' => 'GET'], ], ];
and use instead of
https://domain.xyz/apps/groupquota/quota
this url pattern
https://domain.xyz/ocs/v2.php/apps/groupquota/quota
Hi. Has this task been resolved? Because I've encountered the same problem. And as I see from here, the route was changed, but it for some reason never run into the POST, only into the GET part. Via occ I was able to execute the command correctly and the result was also as expected.
sorry, forgot about this one.. take a look at this bug:
I managed to fix that one.. might it be that that "Q&D fix" fixes this problem too?