Bug 810641

Summary: Picasa uploads fails if filenames have an uppercase extension
Product: [Fedora] Fedora EPEL Reporter: Niels de Vos <ndevos>
Component: googleclAssignee: Niels de Vos <ndevos>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: ndevos
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
See Also: http://code.google.com/p/googlecl/issues/detail?id=473
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-28 12:48:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch, backported from the upstream version none

Description Niels de Vos 2012-04-07 15:23:54 UTC
Description of problem:
The Picasa service of googlecl fails to upload photos that have uppercase filenames. Renaming the photos to have lowercase extensions makes it possible to upload them.

Version-Release number of selected component (if applicable):
googlecl-0.9.9

How reproducible:
100%

Steps to Reproduce:
1. rename a photo to something.JPG
2. google picasa -n 'Drop Box' post something.JPG

  
Actual results:
$ google picasa -n 'Drop Box' post hoppa.JPG 
Loading file hoppa.JPG to album Drop Box
Failed to upload hoppa.JPG. (602: Accepted content types: ['image/bmp', 'image/jpeg', 'image/jpg', 'image/gif', 'image/png', 'image/mpeg', 'image/mpeg4', 'image/3gpp', 'image/quicktime', 'image/mp4', 'image/x-ms-wmv', 'image/avi'])


Expected results:
Upload succeeds.

Additional info:
The problem seems to be that googlecl/picasa/service.py passes the content_type on to the gdata API. googlecl fails to standardize the content_type and the API does a more strict test, causing the upload to fail.

Debugging and some extra checks below:
$ python -m pdb /usr/bin/google picasa -n 'Drop Box' post hoppa.JPG 
> /usr/bin/google(43)<module>()
-> """
(Pdb) b /usr/lib/python2.6/site-packages/gdata/photos/service.py:393
Breakpoint 1 at /usr/lib/python2.6/site-packages/gdata/photos/service.py:393
(Pdb) r
Loading file hoppa.JPG to album Drop Box
> /usr/lib/python2.6/site-packages/gdata/photos/service.py(393)InsertPhoto()
-> 'body':'This is not a valid content type: %s' % content_type,
(Pdb) bt
  /usr/lib64/python2.6/bdb.py(372)run()
-> exec cmd in globals, locals
  <string>(1)<module>()
  /usr/bin/google(577)<module>()
-> main()
  /usr/bin/google(571)main()
-> run_once(options, args)
  /usr/bin/google(418)run_once()
-> task.run(client, options, args)
  /usr/lib/python2.6/site-packages/googlecl/picasa/service.py(406)_run_post()
-> user=options.owner or options.user)
  /usr/lib/python2.6/site-packages/googlecl/picasa/service.py(273)insert_media_list()
-> content_type=content_type)
  /usr/lib/python2.6/site-packages/gdata/photos/service.py(469)InsertPhotoSimple()
-> content_type)
> /usr/lib/python2.6/site-packages/gdata/photos/service.py(393)InsertPhoto()
-> 'body':'This is not a valid content type: %s' % content_type,
(Pdb) print content_type
image/JPG
(Pdb) print filename_or_handle
hoppa.JPG
(Pdb) import mimetypes as m
(Pdb) m.init()
(Pdb) m.guess_type(filename_or_handle)
('image/jpeg', None)

Comment 1 Niels de Vos 2012-04-07 15:46:44 UTC
Created attachment 575949 [details]
Proposed patch, backported from the upstream version

Tested with build https://koji.fedoraproject.org/koji/taskinfo?taskID=3970606

Test done:
$ google picasa -n 'Drop Box' post hoppa.JPG 
Loading file hoppa.JPG to album Drop Box
$ 

Result:
Photo got uploaded successfully.

Comment 2 Fedora Update System 2012-04-07 15:56:31 UTC
googlecl-0.9.9-3.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/googlecl-0.9.9-3.el6

Comment 3 Niels de Vos 2012-04-07 15:59:05 UTC
Filed an errata for easy access to allow other to test/use.

The patch is not upstream yet. I do not have any intention to mark this as stable until the patch gets accepted.

Comment 4 Fedora Update System 2012-04-07 19:25:23 UTC
Package googlecl-0.9.9-3.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing googlecl-0.9.9-3.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-0988/googlecl-0.9.9-3.el6
then log in and leave karma (feedback).

Comment 5 Niels de Vos 2012-05-01 09:05:10 UTC
Tried to get in touch with the developers again:
- http://groups.google.com/group/googlecl-discuss/browse_thread/thread/baa6b94ebf5dbdd0#

Comment 6 Niels de Vos 2014-12-28 12:48:38 UTC
googlecl is getting retired from EPEL-6, this update will not be made available.