Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-02-04 14:12:48 +0300
committerJoas Schilling <coding@schilljs.com>2022-02-07 18:47:51 +0300
commit6dd60b6d304648acf542a84ba76ad5fc0b693b43 (patch)
tree74a9ab5e9f0c9a212211b417320f3453e10b5647 /core/Controller
parenteb340734192e44acc3e4e80442fe54371431ad12 (diff)
Only allow avatars in 64 and 512 pixel size
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/AvatarController.php13
-rw-r--r--core/Controller/GuestAvatarController.php13
2 files changed, 18 insertions, 8 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php
index 5acfe9cd404..ed8d0c3cdeb 100644
--- a/core/Controller/AvatarController.php
+++ b/core/Controller/AvatarController.php
@@ -114,11 +114,16 @@ class AvatarController extends Controller {
* @return JSONResponse|FileDisplayResponse
*/
public function getAvatar($userId, $size) {
- // min/max size
- if ($size > 2048) {
- $size = 2048;
- } elseif ($size <= 0) {
+ if ($size <= 64) {
+ if ($size !== 64) {
+ $this->logger->debug('Avatar requested in deprecated size ' . $size);
+ }
$size = 64;
+ } else {
+ if ($size !== 512) {
+ $this->logger->debug('Avatar requested in deprecated size ' . $size);
+ }
+ $size = 512;
}
try {
diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php
index 57900af810d..6d14474ed44 100644
--- a/core/Controller/GuestAvatarController.php
+++ b/core/Controller/GuestAvatarController.php
@@ -76,11 +76,16 @@ class GuestAvatarController extends Controller {
public function getAvatar($guestName, $size) {
$size = (int) $size;
- // min/max size
- if ($size > 2048) {
- $size = 2048;
- } elseif ($size <= 0) {
+ if ($size <= 64) {
+ if ($size !== 64) {
+ $this->logger->debug('Avatar requested in deprecated size ' . $size);
+ }
$size = 64;
+ } else {
+ if ($size !== 512) {
+ $this->logger->debug('Avatar requested in deprecated size ' . $size);
+ }
+ $size = 512;
}
try {