Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions lib/private/TaskProcessing/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,18 @@
$oldProviders = $this->textToImageManager->getProviders();
$newProviders = [];
foreach ($oldProviders as $oldProvider) {
$newProvider = new class($oldProvider, $this->appData) implements IProvider, ISynchronousProvider {
$newProvider = new class($oldProvider, $this->appData, $this->l10nFactory, $this->userManager) implements IProvider, ISynchronousProvider {
private \OCP\TextToImage\IProvider $provider;
private IAppData $appData;
private IFactory $l10nFactory;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not used here, remove it?


public function __construct(\OCP\TextToImage\IProvider $provider, IAppData $appData) {
private IUserManager $userManager;

public function __construct(\OCP\TextToImage\IProvider $provider, IAppData $appData, IFactory $l10nFactory, IUserManager $userManager) {
$this->provider = $provider;
$this->appData = $appData;
$this->l10nFactory = $l10nFactory;
$this->userManager = $userManager;
}

public function getId(): string {
Expand Down Expand Up @@ -330,6 +335,16 @@
} catch (\OCP\Files\NotFoundException) {
$folder = $this->appData->newFolder('text2image');
}
if ($input['numberOfImages'] > 12) {
throw new ProcessingException(
'numberOfImages cannot be greater than 12'
);
}
if ($input['numberOfImages'] < 1) {
throw new ProcessingException(
'numberOfImages must be greater than 0'
);
}
$resources = [];
$files = [];
for ($i = 0; $i < $input['numberOfImages']; $i++) {
Expand Down Expand Up @@ -1080,7 +1095,7 @@
$task->setEndedAt(time());
$error = 'The task was processed successfully but the provider\'s output doesn\'t pass validation against the task type\'s outputShape spec and/or the provider\'s own optionalOutputShape spec';
$task->setErrorMessage($error);
$this->logger->error($error . ' Output was: ' . var_export($result, true), ['exception' => $e]);

Check failure on line 1098 in lib/private/TaskProcessing/Manager.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedHtml

lib/private/TaskProcessing/Manager.php:1098:64: TaintedHtml: Detected tainted HTML (see https://psalm.dev/245)
} catch (NotPermittedException $e) {
$task->setProgress(1);
$task->setStatus(Task::STATUS_FAILED);
Expand Down
Loading