Bug 1547852

Summary: internal server error when accessing attributes of the "picture" resource
Product: Red Hat CloudForms Management Engine Reporter: Martin Kourim <mkourim>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: medium Docs Contact:
Priority: high    
Version: 5.9.0CC: cpelland, obarenbo
Target Milestone: GAKeywords: Regression, TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:rest
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1552828 (view as bug list) Environment:
Last Closed: 2019-02-11 14:03:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1552828    

Description Martin Kourim 2018-02-22 06:03:01 UTC
Description of problem:
When accessing attributes "href_slug", "region_description", "region_number" and "image_href" of the "pictures" resource the request fails with internal server error:
{
    "error": {
        "kind": "internal_server_error",
        "message": "\"\\x89\" from ASCII-8BIT to UTF-8",
        "klass": "Encoding::UndefinedConversionError"
    }
}

All these attributes are listed by OPTIONS method.


Version-Release number of selected component (if applicable):
5.9.0.21
The identical requests work on 5.8.3.2


How reproducible:
100%


Steps to Reproduce:
1. create picture:
POST /api/pictures
{
	"action": "create",
	"content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
	"extension": "png"
}
2. access attribute
GET /api/pictures/8?attributes=href_slug

Comment 4 CFME Bot 2018-02-27 15:32:12 UTC
New commit detected on ManageIQ/manageiq-api/master:
https://github.com/ManageIQ/manageiq-api/commit/2ae5d7812a56bc6a71ec12fad0357aa8fa6d0d08

commit 2ae5d7812a56bc6a71ec12fad0357aa8fa6d0d08
Author:     Jillian Tullo <jtullo>
AuthorDate: Thu Feb 22 10:45:25 2018 -0500
Commit:     Jillian Tullo <jtullo>
CommitDate: Tue Feb 27 07:49:10 2018 -0500

    Allow for specifying of additional attributes for pictures
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1547852

 app/controllers/api/mixins/pictures.rb     |  4 ++-
 app/controllers/api/pictures_controller.rb |  8 ++++++
 spec/requests/pictures_spec.rb             | 42 ++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 1 deletion(-)

Comment 7 Martin Kourim 2018-07-11 08:03:38 UTC
Verified on 5.10.0.3 using our automated tests.