Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary "Avatar not found" logs by initializing ViewOnlyPlugin for only files #36281

Merged
merged 1 commit into from
Oct 21, 2019
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
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