Skip to content

Commit

Permalink
fixup! tests(s3): Fix NonSeekableStream stream implementation metadat…
Browse files Browse the repository at this point in the history
…a in tests
  • Loading branch information
juliusknorr committed May 23, 2023
1 parent 06b6c39 commit 0277e70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/private/Files/Stream/SeekableHttpStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public function stream_tell() {
public function stream_stat() {
if ($this->getCurrent()) {
$stat = fstat($this->getCurrent());
$stat = $stat ? $stat : [];
$stat['size'] = $this->totalSize;
return $stat;
} else {
Expand Down
13 changes: 6 additions & 7 deletions tests/lib/Files/ObjectStore/S3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ public function stream_open($path, $mode, $options, &$opened_path) {
public function stream_seek($offset, $whence = SEEK_SET) {
return false;
}

public function getMetaData(): array {
$data = parent::getMetaData();
$data['seekable'] = false;
return $data;
}
}

/**
Expand All @@ -86,7 +80,12 @@ public function testUploadNonSeekable() {

$s3 = $this->getInstance();

$s3->writeObject('multiparttest', NonSeekableStream::wrap(fopen(__FILE__, 'r')));
// create a non-seekable resource as a baseline for the stream
@posix_mkfifo('/tmp/fifo', 0644);
$stream = fopen('/tmp/fifo', 'rw+');
stream_set_blocking($stream, false);
fwrite($stream, file_get_contents(__FILE__));
$s3->writeObject('multiparttest', $stream);

$result = $s3->readObject('multiparttest');

Expand Down

0 comments on commit 0277e70

Please sign in to comment.