Skip to content

Commit

Permalink
Merge pull request #119 from mattn/fix-pathstyle
Browse files Browse the repository at this point in the history
Fix S3 path-style option
  • Loading branch information
Brandon Olivares authored May 24, 2022
2 parents e101a39 + f009b0e commit ae44264
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
24 changes: 11 additions & 13 deletions inc/class-destination-s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function option_defaults() {
return [
's3base_url' => '',
's3base_multipart' => true,
's3base_pathstyle' => false,
's3base_pathstylebucket' => false,
's3base_version' => 'latest',
's3base_signature' => 'v4',
's3accesskey' => '',
Expand Down Expand Up @@ -130,12 +130,11 @@ class="regular-text"
</legend>
<label for="s3base_multipart">
<input name="s3base_multipart" type="checkbox"
checked="checked" value="<?= !empty(
BackWPup_Option::get(
$jobid,
's3base_multipart'
)
) ? '1' : '' ?>">
value="1" <?= checked(
BackWPup_Option::get(
$jobid,
's3base_multipart'
), 1) ?>>
<?php esc_html_e(
'Destination supports multipart',
'backwpup'
Expand All @@ -159,12 +158,11 @@ class="regular-text"
<label
for="s3base_pathstylebucket">
<input name="s3base_pathstylebucket" type="checkbox"
value="<?= !empty(
value="1" <?= checked(
BackWPup_Option::get(
$jobid,
's3base_pathstylebucket'
) ? '1' : ''
) ?>">
), 1) ?>>
<?php esc_html_e(
'Destination provides only Pathstyle buckets',
'backwpup'
Expand Down Expand Up @@ -572,8 +570,8 @@ public function edit_form_post_save( $jobid ) {
);
BackWPup_Option::update(
$jobid,
's3base_pathstyle',
isset($_POST['s3base_pathstyle']) ? '1' : ''
's3base_pathstylebucket',
isset($_POST['s3base_pathstylebucket']) ? '1' : ''
);
BackWPup_Option::update(
$jobid,
Expand Down Expand Up @@ -1114,7 +1112,7 @@ function awsgetbucket() {
s3base_version : $( 'input[name="s3base_version"]' ).val(),
s3base_signature : $( 'input[name="s3base_signature"]' ).val(),
s3base_multipart : $( 'input[name="s3base_multipart"]' ).is(':checked'),
s3base_pathstyle : $( 'input[name="s3base_pathstyle"]' ).is(':checked'),
s3base_pathstylebucket : $( 'input[name="s3base_pathstylebucket"]' ).is(':checked'),
_ajax_nonce : $( '#backwpupajaxnonce' ).val()
};
$.post( ajaxurl, data, function ( response ) {
Expand Down
1 change: 1 addition & 0 deletions inc/class-s3-destination.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public function client($accessKey, $secretKey)
'verify' => BackWPup::get_plugin_data('cacert'),
],
'version' => $this->version(),
'use_path_style_endpoint' => $this->onlyPathStyleBucket(),
];

if ($this->endpoint()) {
Expand Down

0 comments on commit ae44264

Please sign in to comment.