Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed ocs function for Group Folders app routes #279

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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