Skip to content

Commit

Permalink
fix: maybe fixing a CakePHP issue
Browse files Browse the repository at this point in the history
Maybe fixing #1014
  • Loading branch information
Rafiot committed Jun 15, 2023
1 parent c8989c2 commit 4085e0f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pymisp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,9 @@ def _prepare_request(self, request_type: str, url: str, data: Union[Iterable, Ma
if url[0] == '/':
# strip it: it will fail if MISP is in a sub directory
url = url[1:]
# Cake PHP being an idiot, it doesn't accepts %20 (space) in the URL path,
# so we need to make it a + instead and hope for the best
url = url.replace(' ', '+')
url = urljoin(self.root_url, url)
if data == {} or isinstance(data, bytes):
d = data
Expand All @@ -3721,6 +3724,7 @@ def _prepare_request(self, request_type: str, url: str, data: Union[Iterable, Ma
# CakePHP params in URL
to_append_url = '/'.join([f'{k}:{v}' for k, v in kw_params.items()])
url = f'{url}/{to_append_url}'

req = requests.Request(request_type, url, data=d, params=params)
user_agent = f'PyMISP {__version__} - Python {".".join(str(x) for x in sys.version_info[:2])}'
if self.tool:
Expand Down

0 comments on commit 4085e0f

Please sign in to comment.