public function getContentType(Path $p) { $md = $this->getMetadata($p); return null !== $md ? $md['content_type'] : null; }
public function getFolder(Path $p, array $ifNoneMatch = null) { if (null !== $ifNoneMatch && in_array($this->md->getVersion($p), $ifNoneMatch)) { throw new RemoteStorageException('folder not modified'); } $f = array('@context' => 'http://remotestorage.io/spec/folder-description', 'items' => $this->d->getFolder($p)); foreach ($f['items'] as $name => $meta) { $f['items'][$name]['ETag'] = $this->md->getVersion(new Path($p->getFolderPath() . $name)); // if item is a folder we don't want Content-Type if (strrpos($name, '/') !== strlen($name) - 1) { $f['items'][$name]['Content-Type'] = $this->md->getContentType(new Path($p->getFolderPath() . $name)); } } return Json::encode($f, JSON_FORCE_OBJECT); }