update attachment

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
Jakob Röhrl
2020-02-21 12:08:24 +01:00
committed by Julius Härtl
parent 1e3ff41cb2
commit 725f99d8b8
6 changed files with 95 additions and 10 deletions

View File

@@ -26,6 +26,7 @@ namespace OCA\Deck\Service;
use OC\Security\CSP\ContentSecurityPolicyManager;
use OCA\Deck\Db\Attachment;
use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
use OCP\AppFramework\Http\FileDisplayResponse;
@@ -42,7 +43,7 @@ use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\Deck\ConflictException;
class FileService implements IAttachmentService {
@@ -154,7 +155,7 @@ class FileService implements IAttachmentService {
$folder = $this->getFolder($attachment);
$fileName = $file['name'];
if ($folder->fileExists($fileName)) {
throw new ConflictException('File already exists.');
throw new ConflictException('File already exists.', $attachment);
}
$target = $folder->newFile($fileName);