ソースを参照

ZF-10017: allow paths with spaces in S3

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23222 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 15 年 前
コミット
b7ff6709ce

+ 1 - 0
library/Zend/Service/Amazon/S3.php

@@ -190,6 +190,7 @@ class Zend_Service_Amazon_S3 extends Zend_Service_Amazon_Abstract
      */
     public function isObjectAvailable($object)
     {
+        $object = $this->_fixupObjectName($object);
         $response = $this->_makeRequest('HEAD', $object);
 
         return ($response->getStatus() == 200);

+ 17 - 0
tests/Zend/Service/Amazon/S3/OnlineTest.php

@@ -423,6 +423,23 @@ class Zend_Service_Amazon_S3_OnlineTest extends PHPUnit_Framework_TestCase
     }
 
     /**
+     * Test that isObjectAvailable() works if object name contains spaces
+     *
+     * @depends testCreateBucket
+     * @depends testObjectPath
+     *
+     * ZF-10017
+     */
+    public function testIsObjectAvailableWithSpacesInKey()
+    {
+        $this->_amazon->createBucket($this->_bucket);
+        $filedir = dirname(__FILE__)."/_files/";
+        $key = $this->_bucket.'/subdir/another dir with spaces/zftestfile.html';
+        $this->_amazon->putFile($filedir."testdata.html", $key);
+        $this->assertTrue($this->_amazon->isObjectAvailable($key));
+    }
+
+    /**
      * Test creating object with https
      *
      * ZF-7029