Fix file_get_content signatures to make it clear it can return false
In File::getContent, which must return a string, throw an Exception
instead of returning false.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
remove listeners to OC_Filesystem::(write|rename) old style hooks
- the events are not emitted anymore
- OC_Filesystem::isBlacklisted() is not called from anywhere else
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This is an helpful helper that should be used in more place than just
server and this is already the case with groupfodlers, deck, user_oidc
and more using it, so let's make it public
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Return 404 when AJAX tries to list dir content but file given
Due to a code mistake, the expected 404 return when AJAX tries to list a directory content with a non-directory file path given, does not happen. It instead fails with another exception.
This commit restores the original intention to return 404 in the first place when passing a non-directory path with the "dir" parameter.
Signed-off-by: MichaIng <micha@dietpi.com>
dont use `false` as cache key for non utf8 path in normalizePath
since `json_encode` returns `false` if it's input isn't utf8, all non utf8 paths passed to normalizePath will currently return the same cached result.
Fixing this makes working with non utf8 storages a *little* bit more possible for apps
Signed-off-by: Robin Appelman <robin@icewind.nl>
This is IMO a bit more readable and it seems to make the code faster.
Tested it on the company instance where there are over 3k calls to this
function. It shaves off around 10ms.
The advantage here is that the pattern gets optimized by php itsel and
cached.
Also looking for all patterns at the same time and especially no longer
looping for /./ patterns should save time.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
On larger instances with a large number of shares this can make a real
impact as the default 512 entries are easily filled.
Making this contain max 2048 entries has basically no effect on smaller
installations (as they probably never hit the 512 now). But makes sure
we don't evict entries in the larger case.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>