Skip to content

Commit 67f484b

Browse files
committed
feat(dav): Enable chunked upload for public shares
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent 577e6aa commit 67f484b

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

apps/dav/appinfo/v1/publicwebdav.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
use OCA\DAV\Files\Sharing\FilesDropPlugin;
1414
use OCA\DAV\Files\Sharing\PublicLinkCheckPlugin;
1515
use OCA\DAV\Storage\PublicOwnerWrapper;
16+
use OCA\DAV\Upload\ChunkingPlugin;
17+
use OCA\DAV\Upload\ChunkingV2Plugin;
1618
use OCA\FederatedFileSharing\FederatedShareProvider;
1719
use OCP\BeforeSabrePubliclyLoadedEvent;
1820
use OCP\Constants;
1921
use OCP\EventDispatcher\IEventDispatcher;
2022
use OCP\Files\IRootFolder;
2123
use OCP\Files\Mount\IMountManager;
24+
use OCP\ICacheFactory;
2225
use OCP\IConfig;
2326
use OCP\IDBConnection;
2427
use OCP\IPreview;
@@ -114,6 +117,8 @@
114117

115118
$server->addPlugin($linkCheckPlugin);
116119
$server->addPlugin($filesDropPlugin);
120+
$server->addPlugin(new ChunkingV2Plugin(Server::get(ICacheFactory::class)));
121+
$server->addPlugin(new ChunkingPlugin());
117122
// allow setup of additional plugins
118123
$event = new BeforeSabrePubliclyLoadedEvent($server);
119124
$eventDispatcher->dispatchTyped($event);

apps/dav/appinfo/v2/publicremote.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use OCA\DAV\Files\Sharing\PublicLinkCheckPlugin;
1515
use OCA\DAV\Storage\PublicOwnerWrapper;
1616
use OCA\DAV\Storage\PublicShareWrapper;
17+
use OCA\DAV\Upload\ChunkingPlugin;
18+
use OCA\DAV\Upload\ChunkingV2Plugin;
1719
use OCA\FederatedFileSharing\FederatedShareProvider;
1820
use OCP\BeforeSabrePubliclyLoadedEvent;
1921
use OCP\Constants;
2022
use OCP\EventDispatcher\IEventDispatcher;
2123
use OCP\Files\IRootFolder;
2224
use OCP\Files\Mount\IMountManager;
25+
use OCP\ICacheFactory;
2326
use OCP\IConfig;
2427
use OCP\IDBConnection;
2528
use OCP\IPreview;
@@ -138,6 +141,8 @@
138141

139142
$server->addPlugin($linkCheckPlugin);
140143
$server->addPlugin($filesDropPlugin);
144+
$server->addPlugin(new ChunkingV2Plugin(Server::get(ICacheFactory::class)));
145+
$server->addPlugin(new ChunkingPlugin());
141146

142147
// allow setup of additional plugins
143148
$event = new BeforeSabrePubliclyLoadedEvent($server);

apps/dav/lib/Connector/Sabre/ServerFactory.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
use OCA\DAV\DAV\CustomPropertiesBackend;
1616
use OCA\DAV\DAV\ViewOnlyPlugin;
1717
use OCA\DAV\Files\BrowserErrorPagePlugin;
18+
use OCA\DAV\Upload\CleanupService;
1819
use OCA\Theming\ThemingDefaults;
1920
use OCP\Accounts\IAccountManager;
2021
use OCP\App\IAppManager;
2122
use OCP\Comments\ICommentsManager;
2223
use OCP\EventDispatcher\IEventDispatcher;
2324
use OCP\Files\Folder;
2425
use OCP\Files\IFilenameValidator;
26+
use OCP\Files\IRootFolder;
2527
use OCP\Files\Mount\IMountManager;
2628
use OCP\IConfig;
2729
use OCP\IDBConnection;
@@ -147,6 +149,15 @@ public function createServer(
147149
'principals/shares',
148150
));
149151

152+
$rootCollection->addChild(new \OCA\DAV\Upload\RootCollection(
153+
$userPrincipalBackend,
154+
'principals/shares',
155+
\OCP\Server::get(CleanupService::class),
156+
\OCP\Server::get(IRootFolder::class),
157+
\OCP\Server::get(IUserSession::class),
158+
\OCP\Server::get(\OCP\Share\IManager::class),
159+
));
160+
150161
$server->addPlugin(
151162
new FilesPlugin(
152163
$tree,

0 commit comments

Comments
 (0)