Skip to content

Commit

Permalink
fixed ocs function for Group Folders app routes
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Jul 30, 2024
1 parent e56e324 commit 86ac367
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
4 changes: 3 additions & 1 deletion nc_py_api/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 86ac367

Please sign in to comment.