Skip to content
This repository was archived by the owner on Jan 27, 2024. It is now read-only.

Commit 51a7ec1

Browse files
committed
Pass size argument to Dropbox client.
1 parent 2f464a6 commit 51a7ec1

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/DropboxAdapter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,10 @@ protected function uploadStream($path, $resource, WriteMode $mode)
300300
{
301301
$location = $this->applyPathPrefix($path);
302302

303-
if (! $result = $this->client->uploadFile($location, $mode, $resource)) {
303+
// If size is zero, consider it unknown.
304+
$size = Util::getStreamSize($resource) ?: null;
305+
306+
if (! $result = $this->client->uploadFile($location, $mode, $resource, $size)) {
304307
return false;
305308
}
306309

tests/DropboxAdapterTests.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ public function testWriteStream(Dropbox $adapter, $mock)
7171
'modified' => '10 September 2000',
7272
], false);
7373

74-
$result = $adapter->writeStream('something', 'contents', new Config());
74+
$result = $adapter->writeStream('something', tmpfile(), new Config());
7575
$this->assertInternalType('array', $result);
7676
$this->assertArrayHasKey('type', $result);
7777
$this->assertEquals('file', $result['type']);
78-
$this->assertFalse($adapter->writeStream('something', 'something', new Config()));
78+
$this->assertFalse($adapter->writeStream('something', tmpfile(), new Config()));
7979
}
8080

8181
/**
@@ -88,11 +88,11 @@ public function testUpdateStream(Dropbox $adapter, $mock)
8888
'modified' => '10 September 2000',
8989
], false);
9090

91-
$result = $adapter->updateStream('something', 'contents', new Config());
91+
$result = $adapter->updateStream('something', tmpfile(), new Config());
9292
$this->assertInternalType('array', $result);
9393
$this->assertArrayHasKey('type', $result);
9494
$this->assertEquals('file', $result['type']);
95-
$this->assertFalse($adapter->updateStream('something', 'something', new Config()));
95+
$this->assertFalse($adapter->updateStream('something', tmpfile(), new Config()));
9696
}
9797

9898
public function metadataProvider()

0 commit comments

Comments
 (0)