From ce8aa406d29ad9385994243fd57f9525dd6c316c Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Thu, 15 Mar 2012 11:06:42 -0500 Subject: [PATCH] Fixing error where container failure is ignored. --- src/HPCloud/Storage/ObjectStorage/Container.php | 2 +- .../Storage/ObjectStorage/StreamWrapper.php | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/HPCloud/Storage/ObjectStorage/Container.php b/src/HPCloud/Storage/ObjectStorage/Container.php index d541062..3769a81 100644 --- a/src/HPCloud/Storage/ObjectStorage/Container.php +++ b/src/HPCloud/Storage/ObjectStorage/Container.php @@ -781,7 +781,7 @@ class Container implements \Countable, \IteratorAggregate { * @deprecated */ public function remoteObject($name) { - $this->proxyObject($name); + return $this->proxyObject($name); } /** diff --git a/src/HPCloud/Storage/ObjectStorage/StreamWrapper.php b/src/HPCloud/Storage/ObjectStorage/StreamWrapper.php index 412d49e..917b5db 100644 --- a/src/HPCloud/Storage/ObjectStorage/StreamWrapper.php +++ b/src/HPCloud/Storage/ObjectStorage/StreamWrapper.php @@ -844,13 +844,19 @@ class StreamWrapper { } // End EXPERIMENTAL section. + // Now we need to get the container. Doing a server round-trip here gives + // us the peace of mind that we have an actual container. + // XXX: Should we make it possible to get a container blindly, without the + // server roundtrip? try { - // Now we need to get the container. Doing a server round-trip here gives - // us the peace of mind that we have an actual container. - // XXX: Should we make it possible to get a container blindly, without the - // server roundtrip? $this->container = $this->store->container($containerName); + } + catch (\HPCloud\Transport\FileNotFoundException $e) { + trigger_error('Container not found.', E_USER_WARNING); + return FALSE; + } + try{ // Now we fetch the file. Only under certain circumstances do we generate // an error if the file is not found. // FIXME: We should probably allow a context param that can be set to @@ -1239,8 +1245,6 @@ class StreamWrapper { * the cached stat['size'] for the underlying buffer. */ protected function generateStat($object, $container, $size) { - - // This is not entirely accurate. Basically, if the // file is marked public, it gets 100775, and if // it is private, it gets 100770.