Skip to content

Commit

Permalink
fix(common_types): fix token bug when submitting attachment to AGOL p…
Browse files Browse the repository at this point in the history
…roxy services
  • Loading branch information
philnagel committed Jun 11, 2024
1 parent 1387069 commit 2c0591e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion restapi/common_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3283,7 +3283,12 @@ def addAttachment(self, oid, attachment, content_type='', gdbVersion=''):
if not content_type:
content_type = self.guess_content_type(attachment, content_type)
files = {ATTACHMENT: (os.path.basename(attachment), open(attachment, 'rb'), content_type)}
return self.__edit_handler(self.request(att_url, params, files=files, cookies=self._cookie, method=POST), oid)
if 'utility.arcgis.com' in self.url.lower() and params[TOKEN]:
token = params[TOKEN]
del params[TOKEN]
return self.__edit_handler(self.client.session.post(att_url, data=params, files=files, cookies=self._cookie, params={TOKEN: token}).json(), oid)
else:
return self.__edit_handler(self.request(att_url, params, files=files, cookies=self._cookie, method=POST), oid)
else:
# need to use multipart upload to work around 10MB limit
parent_service = self.parent_service
Expand Down

0 comments on commit 2c0591e

Please sign in to comment.