From 757bcb2c605f79eac89e8ea6cc08caae333b058b Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 10 Mar 2011 15:26:24 -0700 Subject: [PATCH] fix a couple file upload problems Change-Id: I6c8bfb22709655a8bd2cff2375ab0e4be9dcc5ec Reviewed-on: https://gerrit.instructure.com/2604 Reviewed-by: JT Olds Tested-by: Hudson --- app/controllers/files_controller.rb | 2 ++ lib/authentication_methods.rb | 3 ++- public/javascripts/instructure_helper.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 4b9df526611..7dce90bf79b 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -459,6 +459,8 @@ class FilesController < ApplicationController res[:id] = @attachment.id res[:upload_params].merge!({ + 'Filename' => '', + 'folder' => '', 'key' => full_filename, 'acl' => 'private', 'Policy' => policy_encoded, diff --git a/lib/authentication_methods.rb b/lib/authentication_methods.rb index e86e7bad8e9..72e32ae9ab9 100644 --- a/lib/authentication_methods.rb +++ b/lib/authentication_methods.rb @@ -33,7 +33,8 @@ module AuthenticationMethods def load_pseudonym_from_policy skip_session_save = false - if (policy_encoded = params['Policy']) && + if session.to_hash.empty? && # if there's already some session data, defer to normal auth + (policy_encoded = params['Policy']) && (signature = params['Signature']) && signature == Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Attachment.shared_secret, policy_encoded)).gsub(/\n/, '') && (policy = JSON.parse(Base64.decode64(policy_encoded)) rescue nil) && diff --git a/public/javascripts/instructure_helper.js b/public/javascripts/instructure_helper.js index 1d7a048bfd0..8941cc58246 100644 --- a/public/javascripts/instructure_helper.js +++ b/public/javascripts/instructure_helper.js @@ -1950,7 +1950,7 @@ $newForm.formSubmit({ fileUpload: true, success: success, - onlyGivenParameters: options.onlyGivenParameters, + onlyGivenParameters: options ? options.onlyGivenParameters : false, error: error }); (function() {