Opened 10 years ago

Closed 10 years ago

#5065 closed defect (fixed)

skip_transcode never returns True

Reported by: anongoblin Owned by:
Priority: major Milestone: 0.8.0
Component: programming Keywords:
Cc: Parent Tickets:

Description

In mediagoblin/media_types/video/util.py, skip_transcode

The return type of tags.get_string is a tuple, (bool, value) (ref https://lazka.github.io/pgi-docs/Gst-1.0/structs/TagList.html#Gst.TagList.get_string)
This code assumes that the return value is just a string. As such, it will always return False.

Example:

39 if configmime_types and tags.get_string('mimetype'):
40 if not tags.get_string('mimetype') in configmime_types:
41 return False

If there is no mimetype string in tags, then tags.get_string('mimetype') returns:

(False, None)

Which allows the test on line 40 to pass. Of course, (False, None) does not appear in the list of mimetypes in the config.

In each case, the initial existence test needs a [0] after the get_string, and the second test needs a [1] after the get_string. E.g.:

39 if configmime_types and tags.get_string('mimetype')[0]:
40 if not tags.get_string('mimetype')[1] in configmime_types:
41 return False

(raised as anongoblin as registration is disabled)

Attachments (1)

fix-skip-transcode.patch (1.6 KB ) - added by anongoblin 10 years ago.
Fix patch

Download all attachments as: .zip

Change History (5)

by anongoblin, 10 years ago

Attachment: fix-skip-transcode.patch added

Fix patch

comment:1 by ayleph, 10 years ago

Milestone: 0.8.0

comment:2 by Boris Bobrov, 10 years ago

Thank you, I'm gonna merge it right away.

comment:3 by Boris Bobrov, 10 years ago

fixed by 4522ecef8065c44fab2804ae659812ba5d1e27dd

comment:4 by Boris Bobrov, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.