mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 01:00:50 -04:00
Merge pull request #32323 from nextcloud/fix/noid/preview-duplicate-folder-creation-stable23
[stable23] Fix preview generator trying to recreate an existing folder
This commit is contained in:
commit
6da3fc6458
1 changed files with 10 additions and 2 deletions
|
|
@ -31,6 +31,7 @@ namespace OC\Preview;
|
|||
|
||||
use OCP\Files\File;
|
||||
use OCP\Files\IAppData;
|
||||
use OCP\Files\InvalidPathException;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\NotPermittedException;
|
||||
use OCP\Files\SimpleFS\ISimpleFile;
|
||||
|
|
@ -464,12 +465,19 @@ class Generator {
|
|||
*
|
||||
* @param File $file
|
||||
* @return ISimpleFolder
|
||||
*
|
||||
* @throws InvalidPathException
|
||||
* @throws NotFoundException
|
||||
* @throws NotPermittedException
|
||||
*/
|
||||
private function getPreviewFolder(File $file) {
|
||||
// Obtain file id outside of try catch block to prevent the creation of an existing folder
|
||||
$fileId = (string)$file->getId();
|
||||
|
||||
try {
|
||||
$folder = $this->appData->getFolder($file->getId());
|
||||
$folder = $this->appData->getFolder($fileId);
|
||||
} catch (NotFoundException $e) {
|
||||
$folder = $this->appData->newFolder($file->getId());
|
||||
$folder = $this->appData->newFolder($fileId);
|
||||
}
|
||||
|
||||
return $folder;
|
||||
|
|
|
|||
Loading…
Reference in a new issue