X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/bb93fccf0690344aa77f9538a508959a6de09847..48122cb825f87e469d4363916d56f36eb2f67066:/IkiWiki/Plugin/amazon_s3.pm?ds=sidebyside

diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm
index 93c10b629..cfd8cd347 100644
--- a/IkiWiki/Plugin/amazon_s3.pm
+++ b/IkiWiki/Plugin/amazon_s3.pm
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::amazon_s3;
 use warnings;
 no warnings 'redefine';
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 use IkiWiki::Render;
 use Net::Amazon::S3;
 
@@ -133,7 +133,11 @@ sub getbucket {
 	}
 
 	if (! $bucket) {
-		error(gettext("Failed to create bucket in S3: ").
+		# Try to use existing bucket.
+		$bucket=$s3->bucket($config{amazon_s3_bucket});
+	}
+	if (! $bucket) {
+		error(gettext("Failed to create S3 bucket: ").
 			$s3->err.": ".$s3->errstr."\n");
 	}
 
@@ -178,7 +182,7 @@ sub writefile ($$$;$$) {
 
 	# First, write the file to disk.
 	my $ret=$IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::writefile'}->($file, $destdir, $content, $binary, $writer);
-		
+
 	my @keys=IkiWiki::Plugin::amazon_s3::file2keys("$destdir/$file");
 
 	# Store the data in S3.