set a .csv file extension when using kaltura bulk api

kaltura validates that the file upload has a .csv extension
and canvas was sending just "csvFileData" as the file name

Test Plan:
 * Add a media file into the files area of the course
 * It should get processed by kaltura (show the player after a minute)

closes CNVS-3889

Change-Id: I08dc992bc7f8a50eea6b17eaff92a116e70cf99d
Reviewed-on: https://gerrit.instructure.com/17735
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Bracken Mosbacker 2013-02-14 14:28:03 -07:00 committed by Brian Palmer
parent ae5d165fdb
commit 32ed7d6671
5 changed files with 44 additions and 2 deletions

5
lib/kaltura.rb Normal file
View File

@ -0,0 +1,5 @@
module Kaltura
end
require_dependency 'kaltura/kaltura_client_v3'
require_dependency 'kaltura/kaltura_string_io'

View File

@ -237,7 +237,7 @@ module Kaltura
result = postRequest(:bulkUpload, :add,
:ks => @ks,
:conversionProfileId => -1,
:csvFileData => StringIO.new(csv)
:csvFileData => KalturaStringIO.new(csv, "bulk_data.csv")
)
parseBulkUpload(result)
# results will have entryId values -- do we get them right away?

View File

@ -0,0 +1,10 @@
module Kaltura
class KalturaStringIO < StringIO
attr_accessor :path
def initialize(string="", file_path=nil)
super(string)
self.path = file_path
end
end
end

View File

@ -16,7 +16,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe "Kaltura::ClientV3" do
before(:each) do

View File

@ -0,0 +1,27 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Kaltura::KalturaStringIO do
it "should set path" do
io = Kaltura::KalturaStringIO.new("hey there", "custom_path.csv")
io.path.should == "custom_path.csv"
end
end