Add Application icon via API
Describe the bug I've tried to add an icon for an application, with a SVG file. I've used this call as stated in the doc, but the file is not correctly rendered.
To Reproduce Here is the snippet I'm using:
def add_app_icon(hostname, token, slug, filename):
if not os.path.isfile(filename):
print("File '%s' not found. Exiting" %filename)
exit(1)
url = "https://%s/api/v3/core/applications/%s/set_icon/" % (hostname, slug)
payload = {}
files={
'file': ('file',open(filename,'rb'),'image/svg+xml'),
}
headers = {
'Authorization': 'Bearer %s' % token
}
try:
response = requests.request("POST", url, headers=headers, data=payload, files=files, verify=False)
if not response.ok :
response.raise_for_status()
return response.json()
except Exception as e:
print(repr(e))
return None
When firing this request I get an {} back as response content, and a HTTP 200.
However the icon is not correctly rendered.
The HTTP POST call to set_icon/ is used upload the SVG but then I do not know how to get the path of the image file to update the application (using a PUT request?).
I've analyzed the API calls when performing this actions in a browser and it's the same behavior.
Expected behavior The SVG file being rendered correctly, or the docs to be updated accordingly.
Version and Deployment (please complete the following information):
- authentik version: 2024.6.0
- Deployment: docker-compose
Might be linked to #11029.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Why is this marked as "wont-fix" ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
We are aware of the file APIs to be less than optimal. We'll rework them at some point
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.