Skip to content

Commit b778086

Browse files
committed
applied changes from 3.0.8
1 parent aaa25af commit b778086

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

inc/class-stream-wrapper.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ function () use ( $parts, $path ) {
486486
private function statDirectory( $parts, $path, $flags ) {
487487
// Stat "directories": buckets, or "s3://"
488488
if ( ! $parts['Bucket'] ||
489-
$this->getClient()->doesBucketExist( $parts['Bucket'] )
489+
$this->getClient()->doesBucketExistV2( $parts['Bucket'], false )
490490
) {
491491
return $this->formatUrlStat( $path );
492492
}
@@ -723,9 +723,13 @@ public function dir_readdir() {
723723
$this->objectIterator->next();
724724

725725
// Remove the prefix from the result to emulate other stream wrappers.
726-
return $this->openedBucketPrefix
726+
$retVal = $this->openedBucketPrefix
727727
? substr( $result, strlen( $this->openedBucketPrefix ) )
728728
: $result;
729+
if ( $retVal === '' ) {
730+
$retVal = false;
731+
}
732+
return $retVal;
729733
}
730734

731735
private function formatKey( string $key ) : string {
@@ -816,9 +820,10 @@ private function validate( $path, $mode ) {
816820
/** @var string */
817821
$key = $this->getOption( 'Key' );
818822
if ( $mode == 'x' &&
819-
$this->getClient()->doesObjectExist(
823+
$this->getClient()->doesObjectExistV2(
820824
$bucket,
821825
$key,
826+
false,
822827
$this->getOptions( true )
823828
)
824829
) {
@@ -1031,7 +1036,7 @@ private function formatUrlStat( $result = null ) {
10311036
* @return bool Returns true on success or false on failure
10321037
*/
10331038
private function createBucket( $path, array $params ) {
1034-
if ( $this->getClient()->doesBucketExist( $params['Bucket'] ) ) {
1039+
if ( $this->getClient()->doesBucketExistV2( $params['Bucket'], false ) ) {
10351040
return $this->triggerError( "Bucket already exists: {$path}" );
10361041
}
10371042

@@ -1058,7 +1063,7 @@ private function createSubfolder( string $path, array $params ) {
10581063
$params['Body'] = '';
10591064

10601065
// Fail if this pseudo directory key already exists
1061-
if ( $this->getClient()->doesObjectExist(
1066+
if ( $this->getClient()->doesObjectExistV2(
10621067
$params['Bucket'],
10631068
$params['Key']
10641069
)

0 commit comments

Comments
 (0)