Skip to content

Commit

Permalink
Small Egnyte tweaks (#3568)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves authored Dec 31, 2024
1 parent 2643782 commit aa2e2a6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions backend/onyx/connectors/egnyte/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Any
from typing import cast
from typing import IO
from urllib.parse import quote

import requests
from retry import retry
Expand Down Expand Up @@ -72,7 +73,8 @@ def _make_request() -> requests.Response:
logger.exception(
f"Failed to call Egnyte API.\n"
f"URL: {url}\n"
f"Headers: {headers}\n"
# NOTE: can't log headers because they contain the access token
# f"Headers: {headers}\n"
f"Data: {data}\n"
f"Params: {params}"
)
Expand Down Expand Up @@ -260,7 +262,8 @@ def _get_files_list(
"list_content": True,
}

url = f"{_EGNYTE_API_BASE.format(domain=self.domain)}/fs/{path or ''}"
url_encoded_path = quote(path or "", safe="")
url = f"{_EGNYTE_API_BASE.format(domain=self.domain)}/fs/{url_encoded_path}"
response = _request_with_retries(
method="GET", url=url, headers=headers, params=params, timeout=_TIMEOUT
)
Expand Down Expand Up @@ -315,7 +318,8 @@ def _process_files(
headers = {
"Authorization": f"Bearer {self.access_token}",
}
url = f"{_EGNYTE_API_BASE.format(domain=self.domain)}/fs-content/{file['path']}"
url_encoded_path = quote(file["path"], safe="")
url = f"{_EGNYTE_API_BASE.format(domain=self.domain)}/fs-content/{url_encoded_path}"
response = _request_with_retries(
method="GET",
url=url,
Expand Down

0 comments on commit aa2e2a6

Please sign in to comment.