curationexperts/bawstun — pull request #74 by MatthewStephens (2013-08-07 18:56:45+00:00)
Title: patching method that was failing on empty array

I discovered there are kinds of video files (MJpeg, OGG) that return streams in the GenericFile#ffprobe datastream that lack a codec_name, which returns Nil where an Array is expected. Without an array to work on, #upcase will raise a NoMethodError. Adding the #to_s method to the method chain prevents this.

I can't contribute a test for this, because I discovered the bug while uploading an Apple QT mov that comes with Mountain Lion. The file (Fish.mov, found in /System/Library/Compositions) had two codec streams coming back from ffprobe, and the second one lacked a :codec_name field (it's simply marked as codec_type = 'data'). The call to #first returned nil, and that meant #upcase raised an error.