Created
December 20, 2009 00:46
-
-
Save msonnabaum/260299 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: mm_s3.module | |
=================================================================== | |
RCS file: /cvs/drupal-contrib/contributions/modules/media_mover/contrib/mm_s3/Attic/mm_s3.module,v | |
retrieving revision 1.1.2.2.2.30 | |
diff -u -p -w -r1.1.2.2.2.30 mm_s3.module | |
--- mm_s3.module 7 Dec 2009 15:44:53 -0000 1.1.2.2.2.30 | |
+++ mm_s3.module 20 Dec 2009 00:41:57 -0000 | |
@@ -424,7 +424,10 @@ function mm_s3_send($file, $configuratio | |
// Create the return filepath. We add the bucket file path if | |
// the a custom domain is not being used | |
- if (! $configuration['mm_s3_drupal_file_path']) { | |
+ // Create the return filepath. | |
+ // We add the bucket file path if http(s)://s3.amazonaws.com is being used as the s3 url | |
+ preg_match('@^(?:https?://)?([^/]+)@i', $configuration['mm_s3_server_url'], $domain); | |
+ if ($domain[1] == 's3.amazonaws.com') { | |
$s3_filename = $bucket . '/' . $s3_filename; | |
} | |
return $configuration['mm_s3_server_url'] . $s3_filename; | |
@@ -462,9 +465,12 @@ function mm_s3_delete_file($item, $confi | |
// files is our list of stuff we want to delete. Put it the form bucket/file | |
foreach ($files as $file) { | |
- // @TODO this does not support a custom s3 url like: mybucket.mysite.com/filename.flv | |
+ // remove s3 url | |
$file = str_replace($configuration['mm_s3_server_url'], '', $file); | |
- $delete_files[] = array('bucket' => dirname($file), 'file' => basename($file) ); | |
+ // remove bucket (if not using a custom url) | |
+ $file = str_replace($configuration['mm_s3_bucket']. '/', '', $file); | |
+ | |
+ $delete_files[] = array('bucket' => $configuration['mm_s3_bucket'], 'file' => $file ); | |
} | |
if ($delete_files) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment