Commit Graph

942 Commits (6d5f10eb577a80013c9db9996b156838e4b71908)

Author SHA1 Message Date
Vincent Petry 93fb33d863
Update lib/private/Files/Storage/Wrapper/Availability.php add void
Signed-off-by: Vincent Petry <vincent@nextcloud.com>

Co-authored-by: Carl Schwan <carl@carlschwan.eu>
2021-11-05 10:28:41 +07:00
Vincent Petry db29fd29ee
Return false in hasUpdated when storage is not available
Technically, saying that a storage has no updates when it's not
available is correct.

This makes it possible to retrieve the cache entry for the mount point
and also to list and remove unavailable federated shares.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-11-05 09:48:52 +07:00
John Molakvoæ d6152bf98d
Fix psalm
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2021-11-04 10:24:13 +07:00
John Molakvoæ 44c06a9641
Merge pull request #29502 from nextcloud/revert-27378-dav-recalc-checksum 2021-11-01 13:50:52 +07:00
Robin Appelman 118c647f61
properly handle cases where cache wrappers block access
`CacheWrapper::formatCacheEntry` can return false for files that should be filtered out

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-11-01 11:48:01 +07:00
John Molakvoæ 63d3931e80
Merge pull request #29281 from vijfhoek/master 2021-11-01 11:29:37 +07:00
John Molakvoæ d6a26b2536
Revert "add dav plugin to trigger recalculating of checksums" 2021-11-01 11:26:17 +07:00
John Molakvoæ e1bf5c1cd3
Merge pull request #27378 from nextcloud/dav-recalc-checksum 2021-11-01 11:25:21 +07:00
Carl Schwan df4e6bab69
Merge pull request #29115 from nextcloud/work/carl/correct-permissions-when-copying
Fix permissions when copying from ObjectStorage
2021-10-28 14:38:20 +07:00
Carl Schwan bfa60aaf27
Fix permissions when copying from ObjectStorage
Make sure that when a user copy a file from a directory they don't have
all permissions to a directory where they have more permissions, the
permissions are correctly set to the one from the parent taget folder.

This was caused by the ObjectStoreStorage::copyFromStorage using
the jailed storage and cache entry instead of the unjailed one like other
storages (the local one).
Steps to reproduce

+ Use object storage
+ Create a groupfolder with one group having full permission and another one
  who can just read files.
+ With an user who is in the second group, copy a file from the groupfolder to
  the home folder of this user.
+ The file in the home folder of the user will be read only and can't be deleted
  even though it is in their home folder and they are the owner. In oc_filecache,
  the permissions stored for this file are 1 (READ)

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-28 13:29:50 +07:00
alanmeeson 16f70e8647 Add type hint to fread_block $blockSize param & apply cs:fix.
Signed-off-by: alanmeeson <alan@carefullycalculated.co.uk>
2021-10-23 15:11:23 +07:00
Alan Meeson 44c332a46e Fix truncation of files upon read when using object store and encryption.
When using and object store as primary storage and using the default
encryption module at the same time,  any encrypted file would be truncated
when read, and a text error message added to the end.

This was caused by a combination of the reliance of the read functions on
on knowing the unencrypted file size,  and a bug in the function which
calculated the unencrypted file size for a given file.

In order to calculate the unencrypted file size,  the function would first
skip the header block, then use fseek to skip to the last encrypted block
in the file.  Because there was a corresponence between the encrypted and
unencrypted blocks, this would also be the last encrypted block.  It would
then read the final block and decrypt it to get the unencrypted length of
the last block.  With that, the number of blocks, and the unencrypted block
size, it could calculate the unencrypted file size.

The trouble was that when using an object store, an fread call doesn't
always get you the number of bytes you asked for, even if they are
available.  To resolve this I adapted the stream_read_block function from
lib/private/Files/Streams/Encryption.php to work here.  This function
wraps the fread call in a loop and repeats until it has the entire set of
bytes that were requested,  or there are no more to get.

This fixes the imediate bug, and should (with luck) allow people to get
their encrypted files out of Nextcloud now.  (The problem was purely on
the decryption side).  In the future it would be nice to do some
refactoring here.

I have tested this with image files ranging from 1kb to 10mb using
Nextcloud version 22.1.0 (the nextcloud:22.1-apache docker image), with
sqlite and a Linode object store as the primary storage.

Signed-off-by: Alan Meeson <alan@carefullycalculated.co.uk>
2021-10-23 15:11:23 +07:00
John Molakvoæ f4e4a85fcf
Merge pull request #27440 from nextcloud/is-file-handle 2021-10-23 11:18:52 +07:00
Julius Härtl 6b099ecfe5
Merge pull request #25392 from nextcloud/imountpoint-ocp-storage 2021-10-22 20:14:22 +07:00
John Molakvoæ 2be0eda47c
Merge pull request #29220 from nextcloud/s3-external-list 2021-10-22 12:06:05 +07:00
John Molakvoæ e673ec0b87
Merge branch 'master' into imountpoint-ocp-storage 2021-10-22 11:47:37 +07:00
John Molakvoæ 0a35937662
Merge pull request #26347 from J0WI/clean-path-regex 2021-10-22 11:42:30 +07:00
Carl Schwan 9408f8ae69
Fix security issues when copying groupfolder with advanced ACL
Using advanced ACL, it is possible that an user has access to a
directory but not to a subdirectory, so the copying use
Common::copyFromStorage instead of Local::copyFromStorage.

Fix https://github.com/nextcloud/groupfolders/issues/1692

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-21 17:11:52 +07:00
John Molakvoæ a1c8b6e9eb
Merge pull request #28768 from nextcloud/check-file-exists 2021-10-18 09:54:22 +07:00
Sijmen Schoon 34600c78bb
Move query outside the loop and reduce chunk size to 1000
This involved changing CacheQueryBuilder\whereParentIn to take a
parameter name, renaming the function accordingly.

Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
2021-10-17 20:57:28 +07:00
Sijmen Schoon c959bf2b42
Limit parameter count per query in Cache.removeChildren
Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
2021-10-17 19:10:58 +07:00
Robin Appelman 55346b5d6c
more reliable return value for Watcher::checkUpdate
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-15 16:03:18 +07:00
Robin Appelman 09ffac5e6d
s3 external storage listing rework
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-15 15:35:02 +07:00
John Molakvoæ 739b67031b
Merge pull request #27194 from nextcloud/new-ftp 2021-10-14 10:29:24 +07:00
Daniel 9187e986e1
Merge pull request #28907 from nextcloud/bug/noid/close-stream-local
explicitly close source stream on local / encryption storage
2021-10-08 10:02:01 +07:00
Robin Appelman b3766fc99b
make param names consistent with interface for copy directory polyfill
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-10-07 17:19:44 +07:00
Vincent Petry f518710c52
Merge pull request #28608 from nextcloud/path-prefix-filter
generate a better optimized query for path prefix search filters
2021-10-07 17:16:39 +07:00
acsfer 98eac0fc05
Simplify :) 2021-10-04 17:21:37 +07:00
acsfer 8a8df49bc0
Replace `file_exists()` method by `is_file()` 2021-10-04 17:20:17 +07:00
acsfer 3a25183b66 Get `filesize()` if `file_exists()`
Should make sense.
2021-10-01 21:02:38 +07:00
Daniel Kesselberg be3f4edf1f
explicitly close source stream on encryption storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-09-21 17:42:22 +07:00
Daniel Kesselberg e60a829b42
explicitly close source stream on local storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-09-21 17:41:59 +07:00
Pauli Järvinen a335592f14 Support seeking also from the end of file on S3 storage
The PR https://github.com/nextcloud/server/pull/20033 added support
for `fseek` for  the S3 storage backend. However, the seek mode SEEK_END
was left out that time. This PR fills this gap.

Signed-off-by: Pauli Järvinen <pauli.jarvinen@gmail.com>
2021-09-11 17:43:50 +07:00
Robin Appelman 7351059326
generate a better optimized query for path prefix search filters
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-26 19:07:52 +07:00
Vincent Petry 9c6bbfac45
Unregister enc stream wrapper for any exception
This prevents side effects in tests by properly cleaning up
even with expected exceptions.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-08-26 10:52:23 +07:00
Vincent Petry e32d293346
Merge pull request #28476 from nextcloud/search-jail-insensitive
use case insensitive like when limiting search to jail
2021-08-24 08:59:35 +07:00
Robin Appelman c688703117
use getGetUnjailedRoot to determine if jailed search needs the path filter
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-23 16:27:53 +07:00
Robin Appelman fd5e11a81a
Add dav plugin to trigger recalculating of checksums
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-23 15:38:58 +07:00
Bernd Rederlechner 3866f388b1
Refactor writeObject to only use MultipartUpload when required
Signed-off-by: Bernd Rederlechner <Bernd.Rederlechner@t-systems.com>

Co-authored-by: Julius Härtl <jus@bitgrid.net>
2021-08-20 17:02:25 +07:00
Robin Appelman c48f9ffcdd
use case insensitive like when limiting search to jail
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-17 13:51:45 +07:00
acsfer 9324a74bba Handle files with is_file instead of file_exists
Should fix things like `fread(): read of 8192 bytes failed with errno=21 Is a directory`
2021-08-15 11:55:00 +07:00
Julius Härtl bc3c46362a Make sure that a empty directory can still be deleted when copied from another storage
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-08-13 16:34:48 +07:00
Lukas Reschke 8193a0d1cf
Merge pull request #27923 from nextcloud/remove-flysystem-storage-class
Remove Flysystem storage class
2021-08-10 13:18:46 +07:00
John Molakvoæ 67e6468b9e
Merge pull request #28220 from nextcloud/get-by-id-multiple-mounts-single-storage 2021-08-09 19:27:23 +07:00
Carl Schwan 28970563a2
Remove some mentions of ownCloud from our api documentation
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-07-29 15:56:30 +07:00
Julius Härtl db7ffb0bf9
Merge pull request #28175 from nextcloud/jail-search-root 2021-07-29 09:27:53 +07:00
Robin Appelman 5c2e7c7d28
fix Folder->getById() when a single storage is mounted multiple times
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-07-28 17:21:04 +07:00
Robin Appelman 97aadbe46c
dont apply jail search filter is on the root
the extra '/' breaks things and the filter wouldn't do anything anyway except making the databases job harder

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-07-26 17:44:52 +07:00
Julius Härtl 3e67637a4a
Merge pull request #26463 from Worteks/fix-s3proxy 2021-07-14 23:32:05 +07:00
Lukas Reschke 28359571de Remove Flysystem storage class
This seems unused as per https://github.com/nextcloud/server/issues/27768
and may allow us to get rid of one more dependency.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-07-12 13:21:06 +07:00