Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion apps/files/lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
* filename: ?string,
* lastmod: int,
* mime: string,
* size: int,
* size: int|float,
* type: string,
* hasPreview: bool,
* permissions: int,
* }
*
* @psalm-type FilesTemplateField = array{
Expand Down
19 changes: 16 additions & 3 deletions apps/files/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@
"mime",
"size",
"type",
"hasPreview"
"hasPreview",
"permissions"
],
"properties": {
"basename": {
Expand All @@ -348,14 +349,26 @@
"type": "string"
},
"size": {
"type": "integer",
"format": "int64"
"anyOf": [
{
"type": "integer",
"format": "int64"
},
{
"type": "number",
"format": "double"
}
]
},
"type": {
"type": "string"
},
"hasPreview": {
"type": "boolean"
},
"permissions": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions lib/composer/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public static function getRawData()
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
Expand Down Expand Up @@ -378,7 +378,7 @@ private static function getInstalled()
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
Expand Down
2 changes: 0 additions & 2 deletions lib/composer/composer/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Copyright (c) Nils Adermann, Jordi Boggiano

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -18,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

4 changes: 2 additions & 2 deletions lib/composer/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '3fce359f4c606737b21b1b4213efd5bc5536e867',
'reference' => '8c12590cf6f93ce7aa41f17817b3791e524da39e',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '3fce359f4c606737b21b1b4213efd5bc5536e867',
'reference' => '8c12590cf6f93ce7aa41f17817b3791e524da39e',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
Expand Down
28 changes: 27 additions & 1 deletion lib/private/Files/Node/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OC\User\LazyUser;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\FileInfo;
use OCP\Files\Folder as IFolder;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Node as INode;
use OCP\Files\NotFoundException;
Expand All @@ -26,8 +27,9 @@
use OCP\Files\Search\ISearchOrder;
use OCP\Files\Search\ISearchQuery;
use OCP\IUserManager;
use Override;

class Folder extends Node implements \OCP\Files\Folder {
class Folder extends Node implements IFolder {

private ?IUserManager $userManager = null;

Expand Down Expand Up @@ -480,4 +482,28 @@ private function recreateIfNeeded(): void {
$this->wasDeleted = false;
}
}

#[Override]
public function getOrCreateFolder(string $path, int $maxRetries = 5): IFolder {
$i = 0;
while (true) {
$path = $i === 0 ? $path : $path . ' (' . $i . ')';
try {
$folder = $this->get($path);
if ($folder instanceof IFolder) {
return $folder;
}
} catch (NotFoundException) {
$folder = dirname($path) === '.' ? $this : $this->get(dirname($path));
if (!($folder instanceof Folder)) {
throw new NotPermittedException("Unable to create folder $path. Parent is not a directory.");
}
return $folder->newFolder(basename($path));
}
$i++;
if ($i === $maxRetries) {
throw new NotPermittedException('Unable to load or create folder.');
}
}
}
}
6 changes: 6 additions & 0 deletions lib/private/Files/Node/LazyFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotPermittedException;
use Override;

/**
* Class LazyFolder
Expand Down Expand Up @@ -138,6 +139,11 @@ public function get($path) {
return $this->getRootFolder()->get($this->getFullPath($path));
}

#[Override]
public function getOrCreateFolder(string $path, int $maxRetries = 5): Folder {
return $this->getRootFolder()->getOrCreateFolder($this->getFullPath($path), $maxRetries);
}

/**
* @inheritDoc
*/
Expand Down
Loading
Loading