Skip to content

Commit 34b4068

Browse files
committed
fixed ocs function for Group Folders app routes
Signed-off-by: Alexander Piskun <[email protected]>
1 parent e56e324 commit 34b4068

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ All notable changes to this project will be documented in this file.
66

77
### Fixed
88

9-
- NextcloudApp: `get_computation_device` function now correctly returns result in upper_case.
9+
- Corrected behaviour of `ocs` function for `Group Folders` app routes(they are not fully OCS API). #279
10+
- NextcloudApp: `get_computation_device` function now correctly returns result in upper_case. #278
1011

1112
## [0.15.0 - 2024-07-19]
1213

nc_py_api/_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def __init__(self, **kwargs):
150150
self.init_adapter()
151151
self.init_adapter_dav()
152152
self.response_headers = Headers()
153-
self._ocs_regexp = re.compile(r"/ocs/v[12]\.php/")
153+
self._ocs_regexp = re.compile(r"/ocs/v[12]\.php/|/apps/groupfolders/")
154154

155155
def init_adapter(self, restart=False) -> None:
156156
if getattr(self, "adapter", None) is None or restart:
@@ -288,7 +288,7 @@ def _get_adapter_kwargs(self, dav: bool) -> dict[str, typing.Any]:
288288
def _request_event_ocs(self, request: Request) -> None:
289289
str_url = str(request.url)
290290
if re.search(self._ocs_regexp, str_url) is not None: # this is OCS call
291-
request.url = request.url.copy_merge_params({"format": "json"})
291+
request.headers["Accept"] = "application/json"
292292

293293
def _response_event(self, response: Response) -> None:
294294
str_url = str(response.request.url)
@@ -411,7 +411,7 @@ def _get_adapter_kwargs(self, dav: bool) -> dict[str, typing.Any]:
411411
async def _request_event_ocs(self, request: Request) -> None:
412412
str_url = str(request.url)
413413
if re.search(self._ocs_regexp, str_url) is not None: # this is OCS call
414-
request.url = request.url.copy_merge_params({"format": "json"})
414+
request.headers["Accept"] = "application/json"
415415

416416
async def _response_event(self, response: Response) -> None:
417417
str_url = str(response.request.url)

0 commit comments

Comments
 (0)