summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/pt_BR.js4
-rw-r--r--lib/l10n/pt_BR.json4
-rw-r--r--lib/l10n/ro.js3
-rw-r--r--lib/l10n/ro.json3
-rw-r--r--lib/private/Authentication/Login/SetUserTimezoneCommand.php6
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php32
-rw-r--r--lib/private/Collaboration/Reference/LinkReferenceProvider.php4
-rw-r--r--lib/private/Files/Cache/Scanner.php29
-rw-r--r--lib/private/Preview/BackgroundCleanupJob.php15
9 files changed, 76 insertions, 24 deletions
diff --git a/lib/l10n/pt_BR.js b/lib/l10n/pt_BR.js
index 69b9071e34b..b04846e2756 100644
--- a/lib/l10n/pt_BR.js
+++ b/lib/l10n/pt_BR.js
@@ -57,6 +57,7 @@ OC.L10N.register(
"Invalid image" : "Imagem inválida",
"Avatar image is not square" : "A imagem do avatar não é quadrada",
"View profile" : "Visualizar perfil",
+ "Local time: %s" : "Hora local: %s",
"today" : "hoje",
"tomorrow" : "amanhã",
"yesterday" : "ontem",
@@ -101,6 +102,8 @@ OC.L10N.register(
"Users" : "Usuários",
"Email" : "E-mail",
"Mail %s" : "E-Mail %s",
+ "Fediverse" : "Fediverse",
+ "View %s on the fediverse" : "Ver %s no fediverse",
"Phone" : "Fone",
"Call %s" : "Chamar %s",
"Twitter" : "Twitter",
@@ -152,6 +155,7 @@ OC.L10N.register(
"%1$s shared »%2$s« with you." : "%1$s compartilhou »%2$s« com você.",
"Click the button below to open it." : "Clique no botão abaixo para abri-lo.",
"The requested share does not exist anymore" : "O compartilhamento solicitado não existe mais",
+ "The user was not created because the user limit has been reached. Check your notifications to learn more." : "O usuário não foi criado porque o limite de usuários foi atingido. Confira suas notificações para saber mais.",
"Could not find category \"%s\"" : "Impossível localizar a categoria \"%s\"",
"Sunday" : "Domingo",
"Monday" : "Segunda-feira",
diff --git a/lib/l10n/pt_BR.json b/lib/l10n/pt_BR.json
index dab51898f26..4c1e39643c7 100644
--- a/lib/l10n/pt_BR.json
+++ b/lib/l10n/pt_BR.json
@@ -55,6 +55,7 @@
"Invalid image" : "Imagem inválida",
"Avatar image is not square" : "A imagem do avatar não é quadrada",
"View profile" : "Visualizar perfil",
+ "Local time: %s" : "Hora local: %s",
"today" : "hoje",
"tomorrow" : "amanhã",
"yesterday" : "ontem",
@@ -99,6 +100,8 @@
"Users" : "Usuários",
"Email" : "E-mail",
"Mail %s" : "E-Mail %s",
+ "Fediverse" : "Fediverse",
+ "View %s on the fediverse" : "Ver %s no fediverse",
"Phone" : "Fone",
"Call %s" : "Chamar %s",
"Twitter" : "Twitter",
@@ -150,6 +153,7 @@
"%1$s shared »%2$s« with you." : "%1$s compartilhou »%2$s« com você.",
"Click the button below to open it." : "Clique no botão abaixo para abri-lo.",
"The requested share does not exist anymore" : "O compartilhamento solicitado não existe mais",
+ "The user was not created because the user limit has been reached. Check your notifications to learn more." : "O usuário não foi criado porque o limite de usuários foi atingido. Confira suas notificações para saber mais.",
"Could not find category \"%s\"" : "Impossível localizar a categoria \"%s\"",
"Sunday" : "Domingo",
"Monday" : "Segunda-feira",
diff --git a/lib/l10n/ro.js b/lib/l10n/ro.js
index 54ffe8f5c47..66a4b116f71 100644
--- a/lib/l10n/ro.js
+++ b/lib/l10n/ro.js
@@ -19,6 +19,7 @@ OC.L10N.register(
"Unknown filetype" : "Tip fișier necunoscut",
"Invalid image" : "Imagine invalidă",
"View profile" : "Vezi profilul",
+ "Local time: %s" : "Timp local: %s",
"today" : "astăzi",
"tomorrow" : "mâine",
"yesterday" : "ieri",
@@ -29,6 +30,7 @@ OC.L10N.register(
"next year" : "anul viitor",
"last year" : "ultimul an",
"_%n year ago_::_%n years ago_" : ["%n an în urmă","%n ani în urmâ","%n ani în urmâ"],
+ "_%n hour ago_::_%n hours ago_" : ["%n oră în urmă","%n ore în urmă","%n ore în urmă"],
"in a few seconds" : "în câteva secunde",
"seconds ago" : "secunde în urmă",
"File already exists" : "Fișierul există deja",
@@ -128,6 +130,7 @@ OC.L10N.register(
"Token expired. Please reload page." : "Token expirat. Te rugăm să reîncarci pagina.",
"PHP module %s not installed." : "Modulul PHP %s nu este instalat.",
"PHP setting \"%s\" is not set to \"%s\"." : "Setarea PHP \"%s\" nu este setată la \"%s\".",
+ "PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible." : "PHP este aparent configurat pentru a elimina blocurile de documente inline. Acest lucru va face mai multe aplicații de bază inaccesibile.",
"PHP modules have been installed, but they are still listed as missing?" : "Modulele PHP au fost instalate, dar apar ca lipsind?",
"Storage is temporarily not available" : "Spațiu de stocare este indisponibil temporar",
"%s enter the database username and name." : "%s introdu numele de utilizator și parola pentru baza de date.",
diff --git a/lib/l10n/ro.json b/lib/l10n/ro.json
index 91a2ec39758..fb9fc9b48d9 100644
--- a/lib/l10n/ro.json
+++ b/lib/l10n/ro.json
@@ -17,6 +17,7 @@
"Unknown filetype" : "Tip fișier necunoscut",
"Invalid image" : "Imagine invalidă",
"View profile" : "Vezi profilul",
+ "Local time: %s" : "Timp local: %s",
"today" : "astăzi",
"tomorrow" : "mâine",
"yesterday" : "ieri",
@@ -27,6 +28,7 @@
"next year" : "anul viitor",
"last year" : "ultimul an",
"_%n year ago_::_%n years ago_" : ["%n an în urmă","%n ani în urmâ","%n ani în urmâ"],
+ "_%n hour ago_::_%n hours ago_" : ["%n oră în urmă","%n ore în urmă","%n ore în urmă"],
"in a few seconds" : "în câteva secunde",
"seconds ago" : "secunde în urmă",
"File already exists" : "Fișierul există deja",
@@ -126,6 +128,7 @@
"Token expired. Please reload page." : "Token expirat. Te rugăm să reîncarci pagina.",
"PHP module %s not installed." : "Modulul PHP %s nu este instalat.",
"PHP setting \"%s\" is not set to \"%s\"." : "Setarea PHP \"%s\" nu este setată la \"%s\".",
+ "PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible." : "PHP este aparent configurat pentru a elimina blocurile de documente inline. Acest lucru va face mai multe aplicații de bază inaccesibile.",
"PHP modules have been installed, but they are still listed as missing?" : "Modulele PHP au fost instalate, dar apar ca lipsind?",
"Storage is temporarily not available" : "Spațiu de stocare este indisponibil temporar",
"%s enter the database username and name." : "%s introdu numele de utilizator și parola pentru baza de date.",
diff --git a/lib/private/Authentication/Login/SetUserTimezoneCommand.php b/lib/private/Authentication/Login/SetUserTimezoneCommand.php
index b18851e61fa..57859b032b6 100644
--- a/lib/private/Authentication/Login/SetUserTimezoneCommand.php
+++ b/lib/private/Authentication/Login/SetUserTimezoneCommand.php
@@ -43,7 +43,7 @@ class SetUserTimezoneCommand extends ALoginCommand {
}
public function process(LoginData $loginData): LoginResult {
- if ($loginData->getTimeZoneOffset() !== '') {
+ if ($loginData->getTimeZoneOffset() !== '' && $this->isValidTimezone($loginData->getTimeZone())) {
$this->config->setUserValue(
$loginData->getUser()->getUID(),
'core',
@@ -58,4 +58,8 @@ class SetUserTimezoneCommand extends ALoginCommand {
return $this->processNextOrFinishSuccessfully($loginData);
}
+
+ private function isValidTimezone(?string $value): bool {
+ return $value && in_array($value, \DateTimeZone::listIdentifiers());
+ }
}
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index 7f1b10e0956..c8adec24b31 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -447,12 +447,36 @@ class PublicKeyTokenProvider implements IProvider {
// Update the password for all tokens
$tokens = $this->mapper->getTokenByUser($uid);
- $passwordHash = $this->hashPassword($password);
+ $newPasswordHash = null;
+
+ /**
+ * - true: The password hash could not be verified anymore
+ * and the token needs to be updated with the newly encrypted password
+ * - false: The hash could still be verified
+ * - missing: The hash needs to be verified
+ */
+ $hashNeedsUpdate = [];
+
foreach ($tokens as $t) {
- $publicKey = $t->getPublicKey();
- if ($t->getPasswordHash() === null || $this->hasher->verify(sha1($password) . $password, $t->getPasswordHash())) {
+ if (!isset($hashNeedsUpdate[$t->getPasswordHash()])) {
+ if ($t->getPasswordHash() === null) {
+ $hashNeedsUpdate[$t->getPasswordHash() ?: ''] = true;
+ } elseif (!$this->hasher->verify(sha1($password) . $password, $t->getPasswordHash())) {
+ $hashNeedsUpdate[$t->getPasswordHash() ?: ''] = true;
+ } else {
+ $hashNeedsUpdate[$t->getPasswordHash() ?: ''] = false;
+ }
+ }
+ $needsUpdating = $hashNeedsUpdate[$t->getPasswordHash() ?: ''] ?? true;
+
+ if ($needsUpdating) {
+ if ($newPasswordHash === null) {
+ $newPasswordHash = $this->hashPassword($password);
+ }
+
+ $publicKey = $t->getPublicKey();
$t->setPassword($this->encryptPassword($password, $publicKey));
- $t->setPasswordHash($passwordHash);
+ $t->setPasswordHash($newPasswordHash);
$t->setPasswordInvalid(false);
$this->updateToken($t);
}
diff --git a/lib/private/Collaboration/Reference/LinkReferenceProvider.php b/lib/private/Collaboration/Reference/LinkReferenceProvider.php
index 2cdfb2e0c91..2a6d4d5afaf 100644
--- a/lib/private/Collaboration/Reference/LinkReferenceProvider.php
+++ b/lib/private/Collaboration/Reference/LinkReferenceProvider.php
@@ -117,8 +117,10 @@ class LinkReferenceProvider implements IReferenceProvider {
}
$linkContentType = $headResponse->getHeader('Content-Type');
$expectedContentType = 'text/html';
+ $suffixedExpectedContentType = $expectedContentType . ';';
+ $startsWithSuffixed = substr($linkContentType, 0, strlen($suffixedExpectedContentType)) === $suffixedExpectedContentType;
// check the header begins with the expected content type
- if (substr($linkContentType, 0, strlen($expectedContentType)) !== $expectedContentType) {
+ if ($linkContentType !== $expectedContentType && !$startsWithSuffixed) {
$this->logger->debug('Skip resolving links pointing to content type that is not "text/html"');
return;
}
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index 4799c3bff7d..7be9c750262 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -143,7 +143,7 @@ class Scanner extends BasicEmitter implements IScanner {
// only proceed if $file is not a partial file, blacklist is handled by the storage
if (!self::isPartialFile($file)) {
- //acquire a lock
+ // acquire a lock
if ($lock) {
if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
$this->storage->acquireLock($file, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
@@ -172,7 +172,7 @@ class Scanner extends BasicEmitter implements IScanner {
}
$parent = dirname($file);
- if ($parent === '.' or $parent === '/') {
+ if ($parent === '.' || $parent === '/') {
$parent = '';
}
if ($parentId === -1) {
@@ -180,7 +180,7 @@ class Scanner extends BasicEmitter implements IScanner {
}
// scan the parent if it's not in the cache (id -1) and the current file is not the root folder
- if ($file and $parentId === -1) {
+ if ($file && $parentId === -1) {
$parentData = $this->scanFile($parent);
if (!$parentData) {
return null;
@@ -194,13 +194,9 @@ class Scanner extends BasicEmitter implements IScanner {
/** @var CacheEntry $cacheData */
$cacheData = $this->cache->get($file);
}
- if ($cacheData and $reuseExisting and isset($cacheData['fileid'])) {
+ if ($cacheData && $reuseExisting && isset($cacheData['fileid'])) {
// prevent empty etag
- if (empty($cacheData['etag'])) {
- $etag = $data['etag'];
- } else {
- $etag = $cacheData['etag'];
- }
+ $etag = empty($cacheData['etag']) ? $data['etag'] : $cacheData['etag'];
$fileId = $cacheData['fileid'];
$data['fileid'] = $fileId;
// only reuse data if the file hasn't explicitly changed
@@ -225,11 +221,8 @@ class Scanner extends BasicEmitter implements IScanner {
$newData['parent'] = $parentId;
$data['fileid'] = $this->addToCache($file, $newData, $fileId);
}
- if ($cacheData && isset($cacheData['size'])) {
- $data['oldSize'] = $cacheData['size'];
- } else {
- $data['oldSize'] = 0;
- }
+
+ $data['oldSize'] = ($cacheData && isset($cacheData['size'])) ? $cacheData['size'] : 0;
if ($cacheData && isset($cacheData['encrypted'])) {
$data['encrypted'] = $cacheData['encrypted'];
@@ -252,7 +245,7 @@ class Scanner extends BasicEmitter implements IScanner {
throw $e;
}
- //release the acquired lock
+ // release the acquired lock
if ($lock) {
if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
$this->storage->releaseLock($file, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
@@ -338,7 +331,7 @@ class Scanner extends BasicEmitter implements IScanner {
}
try {
$data = $this->scanFile($path, $reuse, -1, null, $lock);
- if ($data and $data['mimetype'] === 'httpd/unix-directory') {
+ if ($data && $data['mimetype'] === 'httpd/unix-directory') {
$size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data);
$data['size'] = $size;
}
@@ -444,9 +437,9 @@ class Scanner extends BasicEmitter implements IScanner {
$existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : false;
$data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock, $fileMeta);
if ($data) {
- if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE) {
+ if ($data['mimetype'] === 'httpd/unix-directory' && $recursive === self::SCAN_RECURSIVE) {
$childQueue[$child] = $data['fileid'];
- } elseif ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE_INCOMPLETE and $data['size'] === -1) {
+ } elseif ($data['mimetype'] === 'httpd/unix-directory' && $recursive === self::SCAN_RECURSIVE_INCOMPLETE && $data['size'] === -1) {
// only recurse into folders which aren't fully scanned
$childQueue[$child] = $data['fileid'];
} elseif ($data['size'] === -1) {
diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php
index 9a493384f11..4eba96d1a82 100644
--- a/lib/private/Preview/BackgroundCleanupJob.php
+++ b/lib/private/Preview/BackgroundCleanupJob.php
@@ -128,6 +128,21 @@ class BackgroundCleanupJob extends TimedJob {
*/
$like = $this->connection->escapeLikeParameter($data['path']) . '/_/_/_/_/_/_/_/%';
+ /*
+ * Deleting a file will not delete related previews right away.
+ *
+ * A delete request is usually an HTTP request.
+ * The preview deleting is done by a background job to avoid timeouts.
+ *
+ * Previews for a file are stored within a folder in appdata_/preview using the fileid as folder name.
+ * Preview folders in oc_filecache are identified by a.storage, a.path (cf. $like) and a.mimetype.
+ *
+ * To find preview folders to delete, we query oc_filecache for a preview folder in app data, matching the preview folder structure
+ * and use the name to left join oc_filecache on a.name = b.fileid. A left join returns all rows from the left table (a),
+ * even if there are no matches in the right table (b).
+ *
+ * If the related file is deleted, b.fileid will be null and the preview folder can be deleted.
+ */
$qb = $this->connection->getQueryBuilder();
$qb->select('a.name')
->from('filecache', 'a')