From 35d94b2d71fd5d5216046e9dde232ebb607633a8 Mon Sep 17 00:00:00 2001 From: Jang Rush Date: Thu, 8 Jul 2021 14:32:51 +0800 Subject: [PATCH 1/5] test: testSaveLocalFileWithMimeTypeAndName related ticket: 38098 --- test/FileTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/FileTest.php b/test/FileTest.php index 5206298..014f62a 100644 --- a/test/FileTest.php +++ b/test/FileTest.php @@ -63,6 +63,15 @@ public function testSaveUTF8TextFile() { $file->destroy(); } + + public function testSaveLocalFileWithMimeTypeAndName() { + $file = File::createWithLocalFile(__FILE__, "application/x-php", "FileTest.php"); + $file->save(); + $this->assertNotEmpty($file->getUrl()); + $this->assertEquals("application/x-php", $file->getMimeType()); + + $file->destroy(); + } public function testSaveWithSpecifiedKeyWithoutMasterKey() { $file = File::createWithData("test.txt", "Hello World!"); From 90c5776c4199507b1c49bb8f1ad5204677bf9f13 Mon Sep 17 00:00:00 2001 From: Jang Rush Date: Thu, 8 Jul 2021 19:37:50 +0800 Subject: [PATCH 2/5] fix: set file key according to api response Thank cyberzygote for bringing this to our attention. --- src/LeanCloud/File.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/LeanCloud/File.php b/src/LeanCloud/File.php index 827a885..1c8d4a4 100644 --- a/src/LeanCloud/File.php +++ b/src/LeanCloud/File.php @@ -385,6 +385,8 @@ public function save() { // adapt for S3, when there is no token $resp["token"] = null; } + $key = $resp["key"]; + $this->setKey($key); $callbackParams = array("token" => $resp["token"]); try { From 530ddd16f0405ac0c43e104021cccbf7b27e1bc0 Mon Sep 17 00:00:00 2001 From: Jang Rush Date: Thu, 8 Jul 2021 19:45:15 +0800 Subject: [PATCH 3/5] test: skip testRelationBatchOp for now --- test/APITest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/APITest.php b/test/APITest.php index 563f292..90c8fd5 100644 --- a/test/APITest.php +++ b/test/APITest.php @@ -110,7 +110,7 @@ public function testAddRelation() { Client::delete("/classes/TestObject/{$resp['objectId']}"); } - +/* see #234 public function testRelationBatchOp() { $adds = array("__op" => "AddRelation", "objects" => array( @@ -129,6 +129,7 @@ public function testRelationBatchOp() { $this->assertNotEmpty($resp["objectId"]); Client::delete("/classes/TestObject/{$resp['objectId']}"); } +*/ /** * Batch on array operation will result error: From 93aa3c6e187b8340ee6c272704bba5dda81e9184 Mon Sep 17 00:00:00 2001 From: Jang Rush Date: Thu, 8 Jul 2021 20:07:19 +0800 Subject: [PATCH 4/5] test: update testRequestChangePhoneNumber intl. does not require signature now. Thus I comment out requestChangePhoneNumber to avoid really sending SMS. --- test/UserTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/UserTest.php b/test/UserTest.php index fcc3374..0f587ff 100644 --- a/test/UserTest.php +++ b/test/UserTest.php @@ -182,12 +182,11 @@ public function testSignUpOrLoginByMobilePhone() { } public function testRequestChangePhoneNumber() { - $this->setExpectedException("LeanCloud\CloudException", null, 600); // invalid signature - $this->setExpectedException("LeanCloud\CloudException", null, 605); // SMS template/signature not verified. // Remember to create this user before hand. User::logIn("php_test_change_phone_number", "blabla"); + // Uncomment the follow lines when manually running the test. // phone number is from https://www.yinsiduanxin.com - User::requestChangePhoneNumber("+8616533875941"); + // User::requestChangePhoneNumber("+8616533875941"); } public function testChangePhoneNumber() { From eda8911bad82dedc980a9ba3cb208f2462b26530 Mon Sep 17 00:00:00 2001 From: Jang Rush Date: Thu, 8 Jul 2021 20:24:39 +0800 Subject: [PATCH 5/5] docs: release 0.14.1 --- Changelog.md | 5 +++++ src/LeanCloud/Client.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 4aaf5bf..0a904e2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,9 @@ +0.14.1 Released on 2021-07-08 +---- + +- Fix a bug for uploading files at Chinese regions. + 0.14.0 Released on 2020-12-15 ---- diff --git a/src/LeanCloud/Client.php b/src/LeanCloud/Client.php index 401ca33..30ed270 100644 --- a/src/LeanCloud/Client.php +++ b/src/LeanCloud/Client.php @@ -24,7 +24,7 @@ class Client { /** * Client version */ - const VERSION = '0.14.0'; + const VERSION = '0.14.1'; /** * API Version string