Description of problem: Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Sorry for mess bug, saved accidentaly: Description of problem: When updating Service Catalog item picture via API, image is corrupted... POST api/service_templates/:id with data: { "action": "edit", "resource": { "picture": { "content": "<base64 encoded picture data>", "extension": "png" } } } give me result: Status code: 200 Result: { "href": "https://10.44.130.143/api/service_templates/1000000000002", "name": "Test test 2", "id": "1000000000002", "picture": { "id": "1000000000076", "resource_id": "1000000000002", "resource_type": "ServiceTemplate", "extension": "png", "md5": "da5ae2d0b48af98af8d263c88d099ff1", "image_href": "https://10.44.130.143/pictures/1000000000076.png", "href": "https://10.44.130.143/api/pictures/1000000000076" } } This seems OK, but when I get image back via image_href, I got not image itself, but base64 encoded content. When I upload same image directly via UI, image is uploaded correctly. Same picture uploaded via UI (74) and via API (75) discovered via rails console: irb(main):034:0> Picture.find_each { |p| puts p.image_href; puts p.md5 } /pictures/1000000000074.png 0a3a9b482ea341f4c7dabe6a91935cdc /pictures/1000000000075.png da5ae2d0b48af98af8d263c88d099ff1 Testing is based on https://www.manageiq.org/docs/reference/latest/api/reference/pictures Version-Release number of selected component (if applicable): 5.10.12 How reproducible: Upload image via API. Steps to Reproduce: 1. 2. 3. Actual results: Image uploaded via API is corrupted Expected results: Correct image uploaded via API Additional info: python tool for image manipulation and sample image provided...
Created attachment 1634003 [details] tool for manipulating with service catalog item custom images sample usage: ./add_picture_to_service_teplates.py -H server -u user -p password -c example.yml
Created attachment 1634004 [details] sample config for add_custom... script
Created attachment 1634005 [details] Picture used in provided sample
Interesting. We have the create_resource method on https://github.com/ManageIQ/manageiq-api/commit/a094fc43716f1ae20cdf11fe1791d81359a8405e#diff-1ed2364c54258538ea18b6583cd23245R3 which doesn't seem to be running at all, which from the specs however does appear to be working fine (the md5 generated looks correct).
https://github.com/ManageIQ/manageiq-api/pull/777
New commit detected on ManageIQ/manageiq-api/jansa: https://github.com/ManageIQ/manageiq-api/commit/dca8f395455a25f208e27122156e832dbea0b0ef commit dca8f395455a25f208e27122156e832dbea0b0ef Author: Brandon Dunne <bdunne> AuthorDate: Tue Mar 17 16:54:35 2020 +0000 Commit: Brandon Dunne <bdunne> CommitDate: Tue Mar 17 16:54:35 2020 +0000 Merge pull request #777 from d-m-u/add_spec_for_service_template_picture_update_encoding force updated service template photo encoding (cherry picked from commit 57f889ebd3503bc65e27e5c50bf42d525d209516) https://bugzilla.redhat.com/show_bug.cgi?id=1770197 app/controllers/api/service_templates_controller.rb | 5 + spec/requests/service_templates_spec.rb | 19 + 2 files changed, 24 insertions(+)
New commit detected on ManageIQ/manageiq-api/ivanchuk: https://github.com/ManageIQ/manageiq-api/commit/7237c8a65c9414525f3f49334e141b6903ddc524 commit 7237c8a65c9414525f3f49334e141b6903ddc524 Author: Brandon Dunne <bdunne> AuthorDate: Tue Mar 17 16:54:35 2020 +0000 Commit: Satoe Imaishi <simaishi> CommitDate: Thu Jun 18 20:44:32 2020 +0000 Merge pull request #777 from d-m-u/add_spec_for_service_template_picture_update_encoding force updated service template photo encoding (cherry picked from commit 57f889ebd3503bc65e27e5c50bf42d525d209516) https://bugzilla.redhat.com/show_bug.cgi?id=1770197 app/controllers/api/service_templates_controller.rb | 5 + spec/requests/service_templates_spec.rb | 19 + 2 files changed, 24 insertions(+)
FIXED. Verified on 5.11.7.2. Steps taken to verify - 1. Create a service template. 2. Edit the service template by uploading a picture. POST /api/service_templates/:id {'action': 'edit', 'resource': {'picture': {'content': 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAASRJREFUeNrs2dENgjAQBmA0vuMmOgJOwAidxUk6Am5QNkA3cQPsQ00MOWivubZXvD/5n6yEL6UUtGkkEknptK7VIybXtnbE7FolZomoErOGSIo5JECMtlfPuKdtZ/vwjLtxnAloZnxjWCGU6xxRVohvFGdIKCIWwwqx3NkVJwgGAe3sigMEi1jbP1RJSCwiFsMSEYNpuSKwGNLHGWpEEUwqRFYM5ZqYSmGoEKGPKEkwVAgDHDvrzFCtCQhiCNeMN5pwYfc/3+sJbwA69PLShHcnEzATGIzGLngNPIoPkS9IMR2AVwBNtTmajBCDObHjXn7O3A3klOi4oyuUzrUayH3j804uLYEIRCACEYhABPIHEOx/iBfbc6Zze9u+GolEQpKPAAMA4izw+Y/OTcoAAAAASUVORK5CYII=', 'extension': 'png'}}} 3. Query the image_href - GET /api/service_templates/2?attributes=picture.image_href 4. Check if the image is accessible by the image_href received in step 3
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Critical: CloudForms 5.0.7 bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2020:3358