Commit graph

19777 commits

Author SHA1 Message Date
Vincent Petry
1fc27e771c
Merge pull request #30180 from nextcloud/backport/30160/stable23
[stable23] Check resource before closing in encryption wrapper
2021-12-10 08:55:50 +01:00
Vincent Petry
1291abc130 Check resource before closing in encryption wrapper
In case of error there is no guarantee that $source or $target is set or
is a resource when handling an error.

Without this fix, there's a risk that fclose will fail and the actual
exception will not be thrown, making it impossible to find out about the
root cause.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-12-10 00:03:08 +00:00
Christopher Ng
3600b84e6e Fix relation "user_id" already exists migration error
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2021-12-09 23:07:30 +00:00
Côme Chilliet
f889b251b1 Avoid assignment in if clause
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-06 14:22:05 +00:00
Côme Chilliet
3fe20bfbbb Fix typing problems in OC_Image
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-06 14:22:05 +00:00
Côme Chilliet
11b51ddbbe Avoid calling image* methods on boolean
This avoids fatal errors on PHP>=8, and warnings on older versions.
Log should also be clearer.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-06 14:22:05 +00:00
Christoph Wurst
f88f57612b
Merge pull request #30025 from nextcloud/backport/30012/stable23
[stable23] Only check the twofactor state once per request
2021-12-06 14:49:45 +01:00
blizzz
76fa257789
Merge pull request #30036 from nextcloud/backport/30011/stable23
[stable23] Allow to log queries to db, ldap and redis
2021-12-03 11:53:59 +01:00
Robin Appelman
349555478f code checker fixes for instanceOfStorage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-12-02 17:47:06 +00:00
Robin Appelman
c9db02a921 background scan the source storage when a background scan on a storage jail is triggered
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-12-02 17:47:05 +00:00
Robin Appelman
4433732f22 teach psalm about Storage::instanceOfStorage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-12-02 17:47:05 +00:00
Joas Schilling
a361e69d5e Fix log_query config flag
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-02 09:35:52 +00:00
Joas Schilling
5e8fa37852 Allow to log DB, redis and LDAP requests into files
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-02 09:30:44 +00:00
Joas Schilling
febca701ee Only check the twofactor state once per request
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-01 20:29:28 +00:00
blizzz
4caad84389
Merge pull request #29967 from nextcloud/backport/29917/stable23
[stable23] Fix source of translations
2021-11-30 14:55:23 +01:00
Christoph Wurst
3b2122fc11 Include previous execption for repair steps that don't exist
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-11-30 11:56:53 +00:00
Christoph Wurst
3d58f6bd2b Let repair step query exceptions bubble up
And hide the type error caused by a constructor call with missing
arguments.

`new $repairStep();` only works for the rare case that no arguments are
required. Anything else will throw. Then we previously hid the trace of
the more important query exception.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-11-30 11:56:53 +00:00
Christopher Ng
3256de61a1 Fix source of translations
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2021-11-29 18:51:33 +00:00
Christoph Wurst
96aaa5dfa2 Interpolate the log message also for logged exceptions
According to PSR-3 the log message can have placeholders that are
replaced from the context object. Our logger implementation did that for
all PSR-3 logger methods. The only exception was our custom `logException`.

Since PsrLoggerAdapter calls logException when an exception key is
present in the context object, log messages were no longer interpolated.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-11-29 15:48:43 +00:00
Arthur Schiwon
09014ec6d1 Obey col length of 255 to insert and search in accounts_data
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-11-26 17:27:16 +00:00
Arthur Schiwon
c853206e8a add method to shorten a string to given byte size to Utils
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-11-26 17:27:16 +00:00
Carl Schwan
9275a9f28a
Merge pull request #29913 from nextcloud/backport/29906/stable23
[stable23] Use strict comparison to detect usage of redis cluster
2021-11-26 11:16:15 +01:00
Louis Chemineau
3f0cff6667 Use strict comparison to detect usage of redis cluster
Signed-off-by: Louis Chemineau <louis@chmn.me>
2021-11-25 18:57:35 +00:00
Christopher Ng
608cf4a592 Fix inactive profile parameters being returned
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2021-11-25 16:28:34 +00:00
MichaIng
e3de5140b6
Merge pull request #29800 from nextcloud/backport/29632/stable23
[stable23] fix imagecreatetruecolor() error
2021-11-25 17:13:34 +01:00
Joas Schilling
4736bba7f6 Check for invalid characters before trimming
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-11-25 11:49:54 +00:00
szaimen
ce69760500 fix imagecreatetruecolor() error
Signed-off-by: szaimen <szaimen@e.mail.de>
2021-11-23 14:26:26 +00:00
Vincent Petry
6ffd6b2dee Type hint in IpAddress
Signed-off-by: Vincent Petry <vincent@nextcloud.com>

Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
2021-11-23 10:23:02 +00:00
Vincent Petry
e7890cc401 Improve normalizer detecting IPv4 inside of IPv6
The subnet for an IPv4 address inside of IPv6 is now returned in its
IPv4 form.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-23 10:23:02 +00:00
Vincent Petry
e98ee218be Fix getting subnet of ipv4 mapped ipv6 addresses
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-23 10:23:00 +00:00
Christoph Wurst
0afe44c449 Do not print verbose info about app updates if there are none
This is cosmetical but if you have a large number of apps installed then
you'll see a wall of text during the server and app upgrade when it
tries to update each app via the app store. In may cases nothing will be
updated. For those boring cases we can hide the verbose info, but show
when occ is run with -v. Any actual update will still print a few lines.
Those are the important ones for the admin.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-11-22 02:24:59 +00:00
Vincent Petry
f0661de4e5 Normalize directory entries in Encoding wrapper
Directory entry file names are now normalized in getMetaData(),
getDirectoryContents() and opendir().

This makes the scanner work properly as it assumes pre-normalized names.

In case the names were not normalized, the scanner will now skip the
entries and display a warning when applicable.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-19 14:51:38 +00:00
Vincent Petry
516b10de33 Move storage encoding compatibility warning logic
The encoding check for file names is now happening the Scanner, and an
event will be emitted only if the storage doesn't contain the encoding
compatibility wrapper.

The event is listened to by the occ scan command to be able to display a
warning in case of file name mismatches when they have NFD encoding.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-19 14:51:38 +00:00
Vincent Petry
106950d493 Normalize file name before existence check in scanner
The scanner would not find a NFD-encoded file name in an
existing file list that is normalized.

This normalizes the file name before scanning.

Fixes issues where scanning repeatedly would make NFD files flicker in
and out of existence in the file cache.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-19 14:51:38 +00:00
Daniel Calviño Sánchez
8ff4870026 Allow to serve static WebAssembly and TensorFlow Lite files
Since Talk 13 (and thus Nextcloud 23) WebAssembly (.wasm) and TensorFlow
Lite (.tflite) files need to be loaded from the web server to provide
certain features (like the background blur in the WebUI).

Those files can be treated in a similar way to other static resources,
and there should not be any problem caching or compressing them.
However, as compressed TensorFlow Lite files are only ~12% smaller,
the compression directive depends on the MIME type and there is no
standard MIME type for TensorFlow Lite files it is not worth to compress
them.

Moreover, no directives to compress WebAssembly files were added either,
as it seems that they would override any other compression directives
set in the default server configuration; for reference it could be done
with something like:
<IfModule mod_deflate.c>
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/wasm
  </IfModule>
</IfModule>

Depending on the setup "application/wasm" may not be associated with
".wasm" files, so the directive was added just in case, as otherwise
browsers log a warning.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2021-11-17 14:11:52 +00:00
Vincent Petry
2fb31dffc6
Merge pull request #29662 from nextcloud/enhancement/calendar-search-properties-api-stable23
[stable23] Document allowed property names for calendar property searches
2021-11-17 13:14:05 +01:00
Naoto Kobayashi
acece8f4ba OC_Util::isNonUTF8Locale: fix lint error
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-16 17:52:18 +00:00
Naoto Kobayashi
5fc031c91f OC_Util::isSetLocaleWorking: fix typo
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-16 17:52:18 +00:00
Naoto Kobayashi
d27be604d4 OC_Util: Add fallbacks to check if current locale is UTF8
Using escapeshellcmd to get current locale causes error
if the function is disabled.

Add fallbacks to prevent the error.

Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-16 17:52:18 +00:00
Naoto Kobayashi
3b83976c98 Check whether setlocale works only after setlocale
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-16 17:52:18 +00:00
Naoto Kobayashi
7e80182e75 Fix missing setlocale with php 8
When php version = 8, basename('§') does not bug even if LC_ALL is non-UTF-8 locale.
This cause OC_Util::isSetLocaleWorking() to skip setlocale("C.UTF-8").

Fix it by using escapeshellcmd instead of basename.

Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
2021-11-16 17:52:17 +00:00
MichaIng
077c45f173 Correct comment about OC_Defaults being used
Signed-off-by: MichaIng <micha@dietpi.com>
2021-11-16 10:36:05 +00:00
Carl Schwan
b8da11cd62 Fix core depending on theming app
This was introduced in 309354852f
to fix a bug but I can't reproduce the bug after reverting this change.

Ideally we would need to create an interface in OCP and cleanup OC_Defaults
instead of depending on OC_Defaults.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-11-16 10:36:04 +00:00
John Molakvoæ
0233cd4edb
Merge pull request #29716 from nextcloud/bump-doctrine-dbal-23 2021-11-15 19:55:18 +01:00
Joas Schilling
8b0bf9eadf
Allow NULL as well for limit, not integer only
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-11-15 18:53:42 +01:00
Christoph Wurst
bf5c89bbdd
Merge pull request #29671 from nextcloud/backport/29660/stable23
[stable23] Fix initialization of calendar search URIs
2021-11-15 09:52:24 +01:00
Joas Schilling
21f7134fe0 Fix missing token update
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-11-12 14:49:38 +00:00
Christoph Wurst
ddf6b82112 Fix initialization of calendar search URIs
They are an empty array by default. If you don't initialize then
accessing them via the setter will throw a type error.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-11-11 15:07:36 +00:00
Joas Schilling
32005be6b2 Fix updating with apps
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-11-11 13:39:22 +00:00
Christoph Wurst
0b72abb7a5
Document allowed property names for calendar property searches
For API users it looked like any properties could be searched. But it
turned out to be a hand picked list of properties that we index and then
use for the search. To prevent application errors where special props
are not found, I suggest we document the allowed values.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-11-11 11:02:48 +01:00