committed by
Julius Härtl
parent
725f99d8b8
commit
d27a5ac9ba
@@ -25,6 +25,7 @@ namespace OCA\Deck\Service;
|
||||
|
||||
use OC\Security\CSP\ContentSecurityPolicyManager;
|
||||
use OCA\Deck\Db\Attachment;
|
||||
use OCA\Deck\Db\AttachmentMapper;
|
||||
use OCA\Deck\StatusException;
|
||||
use OCA\Deck\Exceptions\ConflictException;
|
||||
use OCP\AppFramework\Http\ContentSecurityPolicy;
|
||||
@@ -53,6 +54,7 @@ class FileService implements IAttachmentService {
|
||||
private $logger;
|
||||
private $rootFolder;
|
||||
private $config;
|
||||
private $attachmentMapper;
|
||||
|
||||
public function __construct(
|
||||
IL10N $l10n,
|
||||
@@ -60,7 +62,8 @@ class FileService implements IAttachmentService {
|
||||
IRequest $request,
|
||||
ILogger $logger,
|
||||
IRootFolder $rootFolder,
|
||||
IConfig $config
|
||||
IConfig $config,
|
||||
AttachmentMapper $attachmentMapper
|
||||
) {
|
||||
$this->l10n = $l10n;
|
||||
$this->appData = $appData;
|
||||
@@ -68,6 +71,7 @@ class FileService implements IAttachmentService {
|
||||
$this->logger = $logger;
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->config = $config;
|
||||
$this->attachmentMapper = $attachmentMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,6 +159,7 @@ class FileService implements IAttachmentService {
|
||||
$folder = $this->getFolder($attachment);
|
||||
$fileName = $file['name'];
|
||||
if ($folder->fileExists($fileName)) {
|
||||
$attachment = $this->attachmentMapper->findByData($attachment->getCardId(), $fileName);
|
||||
throw new ConflictException('File already exists.', $attachment);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user