Closed Luux closed 1 month ago
it is done in 'ocs' function, but for only for ocs
urls
_session.py:
self._ocs_regexp = re.compile(r"/ocs/v[12]\.php/")
def _request_event_ocs(self, request: Request) -> None:
str_url = str(request.url)
if re.search(self._ocs_regexp, str_url) is not None: # this is OCS call
request.url = request.url.copy_merge_params({"format": "json"})
Ah! Could you extend this to support the groupfolders app as well? (Idk if also other apps deviate from the API like this)
I can confirm that extending the regex to self._ocs_regexp = re.compile(r"/ocs/v[12]\.php/|/apps/groupfolders/")
seems to solve the issue already
Reference:
We can temporarily make a workaround for this..
I can confirm that extending the regex to
self._ocs_regexp = re.compile(r"/ocs/v[12]\.php/|/apps/groupfolders/")
seems to solve the issue already
Are you sure that this works?
AFAIK, setting "format=json" works only for native OCS endpoints in Nextcloud(maybe I am wrong).
Only setting Accept: application/json
header works for my setup for groupfolder
endpoints
At least group_folders = nc.ocs(method="GET", path="/apps/groupfolders/folders")
worked without issues. I did not try all available commands though.
@Luux can you please check if the linked PR works for you?
I do not know what is with my dev-setup, but I can not get ?format=json
work in it for GroupFolders app.
results in a JSONDecodeError:
Checking the response and also testing with curl, it seems that the server sends xml back per default. With curl, this can be fixed by adding
-H "Accept: application/json"
- this should be done per default in the ocs function as well.