Bug 8369

Summary: Artifact download links are broken
Product: [Build System, Metadata & Runtime] Toaster Reporter: Elliot Smith <elliot.smith>
Component: toasterAssignee: Elliot Smith <elliot.smith>
Status: VERIFIED FIXED QA Contact: Mihail Stanciu <stanciux.mihail>
Severity: normal    
Priority: Medium+ CC: belen.barros.pena, jessica.zhang, stanciux.mihail
Version: 2.0   
Target Milestone: 2.0   
Hardware: x86   
OS: Multiple   
See Also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8472
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Toaster log showing error and stack trace when artifact link is clicked none

Description Elliot Smith 2015-09-22 10:14:47 UTC
Created attachment 2756 [details]
Toaster log showing error and stack trace when artifact link is clicked

Artifact download links on build pages (at the URL /toastergui/build/X, where X is the build ID) don't link to artifacts correctly.

To reproduce:

1. Run a build in Toaster (managed mode).
2. When the build is finished, go to the "all builds" page and click on the build's link in the "Latest builds" section.
3. In the build detail page, click on one of the artifact links:
   - License manifest > Download 
   - Image files > any of the links to an image file
   - Other artifacts > any of the links to another artifact

* Expected

Download of file behind the link which was clicked.

* Actual

Error is thrown, with the following content (a full log showing the error is attached):

TypeError at /toastergui/build/1/artifact/imagefile/id/1
'int' object is not iterable
Request Method:	GET
Request URL:	http://127.0.0.1:8000/toastergui/build/1/artifact/imagefile/id/1
Django Version:	1.6
Exception Type:	TypeError
Exception Value:	
'int' object is not iterable
Exception Location:	/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/magic/compatability.py in iter_encode, line 40
Python Executable:	/home/ell/toaster-run/toaster-env/bin/python
Python Version:	2.7.5
Python Path:	
['./bitbake/bin/../lib',
 '/home/ell/dev/toaster/poky-contrib/bitbake/lib',
 '/home/ell/dev/toaster/poky-contrib/bitbake/lib/toaster',
 '/home/ell/toaster-run/toaster-env/lib64/python27.zip',
 '/home/ell/toaster-run/toaster-env/lib64/python2.7',
 '/home/ell/toaster-run/toaster-env/lib64/python2.7/plat-linux2',
 '/home/ell/toaster-run/toaster-env/lib64/python2.7/lib-tk',
 '/home/ell/toaster-run/toaster-env/lib64/python2.7/lib-old',
 '/home/ell/toaster-run/toaster-env/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7',
 '/usr/lib/python2.7',
 '/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages',
 '/home/ell/dev/toaster/poky-contrib/bitbake/lib/toaster/contrib/django-aggregate-if-master']
Server time:	Tue, 22 Sep 2015 11:10:44 +0100

***
Note that this seems to be related to mime type lookup, so it would make sense to rationalise the code causing the error so it reuses the MimeTypeFinder in views.py.
Comment 1 Elliot Smith 2015-09-24 13:14:44 UTC
Sent to toaster mailing list for review.
Comment 2 Elliot Smith 2015-10-09 13:30:08 UTC
This was submitted to bitbake-devel 2015-10-07.
Comment 3 Elliot Smith 2015-10-09 13:31:43 UTC
*** Bug 8472 has been marked as a duplicate of this bug. ***
Comment 4 Elliot Smith 2015-10-12 13:33:40 UTC
This is not in poky master, so it shouldn't have been closed.
Comment 5 Elliot Smith 2015-10-13 08:39:57 UTC
The necessary patches are dd957fe0f261db6481882fee0413f459425000c2 and ce9011a9dea4d4f8040170c28031cfbcadfbfd81 on poky master, if we decide to backport them.
Comment 6 Elliot Smith 2015-10-13 08:40:20 UTC
Now made it upstream, so closing.
Comment 7 Mihail Stanciu 2015-10-26 10:05:36 UTC
Verified on master: 505a82673ac2487df5ea343a6422c2fc47018831