diff --git a/CHANGELOG.md b/CHANGELOG.md index c113bef0..3ed61988 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ All notable changes to this project will be documented in this file. ### Fixed -- NextcloudApp: `get_computation_device` function now correctly returns result in upper_case. +- Corrected behaviour of `ocs` function for `Group Folders` app routes(they are not fully OCS API). #279 +- NextcloudApp: `get_computation_device` function now correctly returns result in upper_case. #278 ## [0.15.0 - 2024-07-19] diff --git a/nc_py_api/_session.py b/nc_py_api/_session.py index bf3353c7..27bd93e6 100644 --- a/nc_py_api/_session.py +++ b/nc_py_api/_session.py @@ -150,7 +150,7 @@ def __init__(self, **kwargs): self.init_adapter() self.init_adapter_dav() self.response_headers = Headers() - self._ocs_regexp = re.compile(r"/ocs/v[12]\.php/") + self._ocs_regexp = re.compile(r"/ocs/v[12]\.php/|/apps/groupfolders/") def init_adapter(self, restart=False) -> None: if getattr(self, "adapter", None) is None or restart: @@ -289,6 +289,7 @@ 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"}) + request.headers["Accept"] = "application/json" def _response_event(self, response: Response) -> None: str_url = str(response.request.url) @@ -412,6 +413,7 @@ async 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"}) + request.headers["Accept"] = "application/json" async def _response_event(self, response: Response) -> None: str_url = str(response.request.url)