fix a couple file upload problems

Change-Id: I6c8bfb22709655a8bd2cff2375ab0e4be9dcc5ec
Reviewed-on: https://gerrit.instructure.com/2604
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
Jon Jensen 2011-03-10 15:26:24 -07:00
parent 26c3ae2a81
commit 757bcb2c60
3 changed files with 5 additions and 2 deletions

View File

@ -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,

View File

@ -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) &&

View File

@ -1950,7 +1950,7 @@
$newForm.formSubmit({
fileUpload: true,
success: success,
onlyGivenParameters: options.onlyGivenParameters,
onlyGivenParameters: options ? options.onlyGivenParameters : false,
error: error
});
(function() {