Skip to content

Instantly share code, notes, and snippets.

@alecguintu
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save alecguintu/971eb66d020803b2d9c3 to your computer and use it in GitHub Desktop.

Select an option

Save alecguintu/971eb66d020803b2d9c3 to your computer and use it in GitHub Desktop.

Revisions

  1. alecguintu revised this gist Sep 2, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pickMultiple_store_remove.js.coffee
    Original file line number Diff line number Diff line change
    @@ -5,5 +5,5 @@ filepicker.pickMultiple picker_options, (pick_fpfiles) ->
    filepicker.store pick_fpfile, store_options, (store_fpfile) ->
    # Remove files from both fp.io and our root s3 path

    # Here's where the problem happens. pick_fpfile is always the from the list of pick_fpfiles since filepicker.store is asynchronous and pick_fpfile has already changed by the time the filepicker.remove's success callback has returned
    # Here's where the problem happens. pick_fpfile is always the last from the list of pick_fpfiles since filepicker.store is asynchronous and pick_fpfile has already changed by the time the filepicker.remove's success callback has returned
    filepicker.remove pick_fpfile, {policy: security.policy, signature: security.signature}
  2. alecguintu revised this gist Sep 2, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pickMultiple_store_remove.js.coffee
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,6 @@ filepicker.pickMultiple picker_options, (pick_fpfiles) ->

    filepicker.store pick_fpfile, store_options, (store_fpfile) ->
    # Remove files from both fp.io and our root s3 path

    # Here's where the problem happens. pick_fpfile is always the from the list of pick_fpfiles since filepicker.store is asynchronous and pick_fpfile has already changed by the time the filepicker.remove's success callback has returned
    filepicker.remove pick_fpfile, {policy: security.policy, signature: security.signature}
  3. alecguintu created this gist Sep 2, 2014.
    7 changes: 7 additions & 0 deletions pickMultiple_store_remove.js.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    filepicker.pickMultiple picker_options, (pick_fpfiles) ->
    for pick_fpfile, i in pick_fpfiles
    sanitized_filename = sanitize_filename(pick_fpfile.filename)

    filepicker.store pick_fpfile, store_options, (store_fpfile) ->
    # Remove files from both fp.io and our root s3 path
    filepicker.remove pick_fpfile, {policy: security.policy, signature: security.signature}