aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filebackend/SwiftFileBackend.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/filebackend/SwiftFileBackend.php')
-rw-r--r--includes/filebackend/SwiftFileBackend.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php
index 528889b69bf6..037b1c3c3043 100644
--- a/includes/filebackend/SwiftFileBackend.php
+++ b/includes/filebackend/SwiftFileBackend.php
@@ -142,6 +142,10 @@ class SwiftFileBackend extends FileBackendStore {
$this->srvCache = $this->srvCache ?: new EmptyBagOStuff();
}
+ public function getFeatures() {
+ return ( FileBackend::ATTR_HEADERS | FileBackend::ATTR_METADATA );
+ }
+
protected function resolveContainerPath( $container, $relStoragePath ) {
if ( !mb_check_encoding( $relStoragePath, 'UTF-8' ) ) { // mb_string required by CF
return null; // not UTF-8, makes it hard to use CF and the swift HTTP API
@@ -179,6 +183,8 @@ class SwiftFileBackend extends FileBackendStore {
continue; // blacklisted
} elseif ( preg_match( '/^(x-)?content-/', $name ) ) {
$headers[$name] = $value; // allowed
+ } elseif ( preg_match( '/^content-(disposition)/', $name ) ) {
+ $headers[$name] = $value; // allowed
}
}
}
@@ -189,7 +195,7 @@ class SwiftFileBackend extends FileBackendStore {
$part = trim( $part );
$new = ( $disposition === '' ) ? $part : "{$disposition};{$part}";
if ( strlen( $new ) <= 255 ) {
- $res = $new;
+ $disposition = $new;
} else {
break; // too long; sigh
}
@@ -986,6 +992,20 @@ class SwiftFileBackend extends FileBackendStore {
$this->cheapCache->set( $path, 'stat', $val );
}
+ protected function doGetFileXAttributes( array $params ) {
+ $stat = $this->getFileStat( $params );
+ if ( $stat ) {
+ if ( !isset( $stat['xattr'] ) ) {
+ // Stat entries filled by file listings don't include metadata/headers
+ $this->clearCache( array( $params['src'] ) );
+ $stat = $this->getFileStat( $params );
+ }
+ return $stat['xattr'];
+ } else {
+ return false;
+ }
+ }
+
protected function doGetFileSha1base36( array $params ) {
$stat = $this->getFileStat( $params );
if ( $stat ) {