Permalink
Browse files

Fixing inclusion of fileDesc in PASS_THRU_OPTIONS, which results in a…

… policy error when set. (Because fileDesc wasn't actually passed through, when it was set as an option a policy was automatically created which did not reflect the post vars sent to S3.)
  • Loading branch information...
1 parent e122d85 commit 39aae4350ae60633cf2b270e9de69e5483d31e03 @sbc committed Mar 10, 2011
Showing with 10 additions and 4 deletions.
  1. +10 −4 uploadify_s3/uploadify_s3.py
@@ -12,8 +12,8 @@
UPLOADIFY_METHODS = ('onAllComplete', 'onCancel', 'onCheck', 'onClearQueue', 'onComplete', 'onError', 'onInit', 'onOpen', 'onProgress', 'onQueueFull', 'onSelect', 'onSelectOnce', 'onSWFReady')
-PASS_THRU_OPTIONS = ('folder', 'fileExt', 'fileDesc')
-FILTERED_OPTIONS = ('filename',)
+PASS_THRU_OPTIONS = ('folder', 'fileExt',)
+FILTERED_KEYS = ('filename',)
EXCLUDED_KEYS = ('AWSAccessKeyId', 'policy', 'signature')
# AWS Options
@@ -93,17 +93,23 @@ def get_options_json(self):
return out
def build_conditions(options, post_data, conditions):
+ # PASS_THRU_OPTIONS are Uploadify options that if set in the settings are
+ # passed into the POST. As a result, a default policy condition is created here.
for opt in PASS_THRU_OPTIONS:
if opt in options and opt not in conditions:
conditions[opt] = None
- for opt in FILTERED_OPTIONS:
+ # FILTERED_KEYS are those created by Uploadify and passed into the POST on submit.
+ # As a result, a default policy condition is created here.
+ for opt in FILTERED_KEYS:
if opt not in conditions:
conditions[opt] = None
conds = post_data.copy()
conds.update(conditions)
+ # EXCLUDED_KEYS are those that are set by UploadifyS3 but need to be stripped out
+ # for the purposes of creating conditions.
for key in EXCLUDED_KEYS:
if key in conds:
del conds[key]
@@ -147,4 +153,4 @@ def _set_default_if_none(dict, key, default=None):
else:
raise ValueError
-
+

0 comments on commit 39aae43

Please sign in to comment.