mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
file storage fixes
This commit is contained in:
@@ -35,7 +35,7 @@ use Psr\Http\Message\StreamInterface;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
use function GuzzleHttp\Psr7\stream_for;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
|
||||
/**
|
||||
* An access point for file storing and fetching. Files are represented as Attachment entities.
|
||||
@@ -119,7 +119,7 @@ class Manager
|
||||
{
|
||||
$implementation = $this->getImplementation($attachment);
|
||||
|
||||
$stream = stream_for($contents);
|
||||
$stream = Utils::streamFor($contents);
|
||||
|
||||
$implementation->putStream(self::wrapAttachmentEntity($attachment), $stream);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,8 @@ class AwsS3 implements Storage
|
||||
throw new RuntimeException("Could not open temp.");
|
||||
}
|
||||
|
||||
$stream->rewind();
|
||||
|
||||
fwrite($resource, $stream->getContents());
|
||||
rewind($resource);
|
||||
|
||||
|
||||
@@ -99,6 +99,9 @@ class EspoUploadDir implements Storage, Local
|
||||
{
|
||||
$filePath = $this->getFilePath($attachment);
|
||||
|
||||
$stream->rewind();
|
||||
|
||||
// @todo Use a resource to write a file (add a method to the file manager).
|
||||
$contents = $stream->getContents();
|
||||
|
||||
$result = $this->fileManager->putContents($filePath, $contents);
|
||||
|
||||
Reference in New Issue
Block a user