aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-10-22 12:20:29 +0200
committerMarcel Klehr <mklehr@gmx.net>2023-10-22 12:20:29 +0200
commit4055a900041f6ede05f6eee76ded8d91627850db (patch)
tree1f5dff793efc7b399a107d709730974de2f59e8d /lib
parent9787f9dba010f17bb53e88989716c94d677c0916 (diff)
downloadnextcloud-server-4055a900041f6ede05f6eee76ded8d91627850db.tar.gz
nextcloud-server-4055a900041f6ede05f6eee76ded8d91627850db.zip
fix(Text2Image): Fix $completionExpectedAt default value
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/public/TextToImage/Task.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/public/TextToImage/Task.php b/lib/public/TextToImage/Task.php
index 20ae32e0f6b..b4662a76dcb 100644
--- a/lib/public/TextToImage/Task.php
+++ b/lib/public/TextToImage/Task.php
@@ -40,7 +40,7 @@ use OCP\Image;
final class Task implements \JsonSerializable {
protected ?int $id = null;
- protected DateTime $completionExpectedAt;
+ protected ?DateTime $completionExpectedAt = null;
/**
* @since 28.0.0
@@ -95,7 +95,9 @@ final class Task implements \JsonSerializable {
$folder = $appData->getFolder('text2image')->getFolder((string)$this->getId());
$images = [];
for ($i = 0; $i < $this->getNumberOfImages(); $i++) {
- $images[] = new Image(base64_encode($folder->getFile((string) $i)->getContent()));
+ $image = new Image();
+ $image->loadFromFileHandle($folder->getFile((string) $i)->read());
+ $images[] = $image;
}
return $images;
} catch (NotFoundException|NotPermittedException) {
@@ -128,18 +130,18 @@ final class Task implements \JsonSerializable {
}
/**
- * @param DateTime $at
+ * @param ?DateTime $at
* @since 28.0.0
*/
- final public function setCompletionExpectedAt(DateTime $at): void {
+ final public function setCompletionExpectedAt(?DateTime $at): void {
$this->completionExpectedAt = $at;
}
/**
- * @return DateTime
+ * @return ?DateTime
* @since 28.0.0
*/
- final public function getCompletionExpectedAt(): DateTime {
+ final public function getCompletionExpectedAt(): ?DateTime {
return $this->completionExpectedAt;
}
@@ -192,7 +194,7 @@ final class Task implements \JsonSerializable {
}
/**
- * @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, identifier: ?string, numberOfImages: int, completionExpectedAt: int}
+ * @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, identifier: ?string, numberOfImages: int, completionExpectedAt: ?int}
* @since 28.0.0
*/
public function jsonSerialize(): array {