Nextcloud ok save doc

This commit is contained in:
2026-05-29 06:54:07 +02:00
parent ab038aa6be
commit 5557650824
111 changed files with 14283 additions and 56 deletions
+12 -4
View File
@@ -129,7 +129,7 @@ class StorageRepositoryService
return $config;
}
private function normalizePath(string $path): string
public function normalizePath(string $path): string
{
$path = trim($path);
if ($path === '' || $path === '\\') {
@@ -148,6 +148,15 @@ class StorageRepositoryService
private function buildWebDAV(array $config): ?Filesystem
{
$fullBaseUri = rtrim($config['base_uri'] ?? '', '/') . '/';
$parsedUrl = parse_url($fullBaseUri);
$schemeHost = ($parsedUrl['scheme'] ?? 'https') . '://' . ($parsedUrl['host'] ?? 'localhost');
$basePath = rawurldecode($parsedUrl['path'] ?? '/');
$root = '/' . trim($config['root'] ?? '/', '/') . '/';
$prefix = rtrim($basePath, '/') . $root;
$authType = match ($config['auth_type'] ?? 'basic') {
'basic' => WebDAVClient::AUTH_BASIC,
'digest' => WebDAVClient::AUTH_DIGEST,
@@ -156,14 +165,13 @@ class StorageRepositoryService
};
$client = new WebDAVClient([
'baseUri' => rtrim($config['base_uri'] ?? '', '/') . '/',
'baseUri' => $schemeHost . '/',
'userName' => $config['username'] ?? '',
'password' => $config['password'] ?? '',
'authType' => $authType,
]);
$root = ltrim($config['root'] ?? '/', '/');
$adapter = new WebDAVAdapter($client, $root);
$adapter = new WebDAVAdapter($client, $prefix);
return new Filesystem($adapter);
}