Skip to content

Commit

Permalink
Merge pull request #36281 from owncloud/fix-avatar
Browse files Browse the repository at this point in the history
Avoid unnecessary "Avatar not found" logs by initializing ViewOnlyPlugin for only files
  • Loading branch information
karakayasemi authored Oct 21, 2019
2 parents 6cb568c + 71dfb32 commit c75fecf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/dav/lib/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public function __construct(IRequest $request, $baseUri) {
$this->server->addPlugin(new PublicFilesPlugin());
$authPlugin->addBackend(new PublicSharingAuth($this->server, OC::$server->getShareManager()));
$this->server->addPlugin(new PublicLinkEventsPlugin(\OC::$server->getEventDispatcher()));
$this->server->addPlugin(new PublicFilesPlugin());
}
$authPlugin->addBackend(new PublicAuth());
$this->server->addPlugin($authPlugin);
Expand Down Expand Up @@ -218,10 +217,11 @@ public function __construct(IRequest $request, $baseUri) {
OC::$server->getLazyRootFolder()
));

// Allow view-only plugin for webdav requests
$this->server->addPlugin(new ViewOnlyPlugin(
OC::$server->getLogger()
));
if ($this->isRequestForSubtree(['files', 'trash-bin', 'public-files'])) {
$this->server->addPlugin(new ViewOnlyPlugin(
OC::$server->getLogger()
));
}

if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
$this->server->addPlugin(new BrowserErrorPagePlugin());
Expand All @@ -245,7 +245,7 @@ public function __construct(IRequest $request, $baseUri) {
)
);

if ($this->isRequestForSubtree(['files', 'uploads', 'trash-bin'])) {
if ($this->isRequestForSubtree(['files', 'uploads', 'trash-bin', 'public-files'])) {
//For files only
$filePropertiesPlugin = new FileCustomPropertiesPlugin(
new FileCustomPropertiesBackend(
Expand Down
1 change: 1 addition & 0 deletions apps/dav/tests/unit/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function providesUris() {
'principals' => ['principals/users/admin', ['caldav', 'oc-resource-sharing', 'carddav']],
'calendars' => ['calendars/admin', ['caldav', 'oc-resource-sharing']],
'addressbooks' => ['addressbooks/admin', ['carddav', 'oc-resource-sharing']],
'files' => ['files/admin', ['OCA\DAV\DAV\ViewOnlyPlugin']]
];
}
}
5 changes: 5 additions & 0 deletions changelog/unreleased/36281
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Avoid unnecessary "Avatar not found" logs by initializing ViewOnlyPlugin for only files

ViewOnlyPlugin was producing too many warning logs for users who have not an avatar. By registering ViewOnlyPlugin for only files problem resolved.

https://github.com/owncloud/core/pull/36281

0 comments on commit c75fecf

Please sign in to comment.