File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
apps/files_external/lib/Lib/Storage Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -732,8 +732,7 @@ public function versioningEnabled(): bool {
732732 if ($ this ->versioningEnabled === null ) {
733733 $ cached = $ this ->memCache ->get ('versioning-enabled:: ' . $ this ->getBucket ());
734734 if ($ cached === null ) {
735- $ result = $ this ->getConnection ()->getBucketVersioning (['Bucket ' => $ this ->getBucket ()]);
736- $ this ->versioningEnabled = $ result ->get ('Status ' ) === 'Enabled ' ;
735+ $ this ->versioningEnabled = $ this ->getVersioningStatusFromBucket ();
737736 $ this ->memCache ->set ('versioning-enabled:: ' . $ this ->getBucket (), $ this ->versioningEnabled , 60 );
738737 } else {
739738 $ this ->versioningEnabled = $ cached ;
@@ -742,6 +741,19 @@ public function versioningEnabled(): bool {
742741 return $ this ->versioningEnabled ;
743742 }
744743
744+ protected function getVersioningStatusFromBucket (): bool {
745+ try {
746+ $ result = $ this ->getConnection ()->getBucketVersioning (['Bucket ' => $ this ->getBucket ()]);
747+ return $ result ->get ('Status ' ) === 'Enabled ' ;
748+ } catch (S3Exception $ s3Exception ) {
749+ // This is needed for compatibility with Storj gateway which does not support versioning yet
750+ if ($ s3Exception ->getAwsErrorCode () === 'NotImplemented ' ) {
751+ return false ;
752+ }
753+ throw $ s3Exception ;
754+ }
755+ }
756+
745757 public function hasUpdated ($ path , $ time ) {
746758 // for files we can get the proper mtime
747759 if ($ path !== '' && $ object = $ this ->headObject ($ path )) {
You can’t perform that action at this time.
0 commit comments