summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few psalm issues and moved back to psalm/phar 4.18Carl Schwan2022-01-121-1/+1
| | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Make max size for single put uploads configurableJulius Härtl2021-12-292-2/+6
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Merge pull request #28610 from nextcloud/enh/preview-cleanup-queryJulius Härtl2021-12-281-1/+1
|\
| * Use storage filter when fetching previews to cleanupJulius Härtl2021-08-261-1/+1
| | | | | | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* | Fix php-cs for S3ConnectionTrait.phpJulius Härtl2021-12-211-1/+0
| | | | | | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* | Merge pull request #27493 from cuppett/cuppett/simplify-aws-credential-providerJulius Härtl2021-12-211-6/+2
|\ \
| * | Simplify S3ConnectionTrait to defaultProvider plus optionStephen Cuppett2021-11-221-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we initially added the EC2 and ECS IAM role support in #24700, we had to use a workaround by explicitly ordering the various providers due to an inconsistency in the AWS SDK for PHP. We submitted a PR there to get that squared away. Now, we've consumed that version upstream for the SDK and can update our code here to be the most concise version as well as position ourselves to pick up new methods as those become available and prevalent in AWS (for acquiring credentials). See also: https://github.com/nextcloud/server/pull/24700#issuecomment-747650892 See also: https://github.com/aws/aws-sdk-php/pull/2172 Signed-off-by: Stephen Cuppett <steve@cuppett.com>
* | | Merge pull request #30160 from ↵Pytal2021-12-091-2/+6
|\ \ \ | | | | | | | | | | | | nextcloud/bugfix/noid/encryption-wrapper-fclose-check
| * | | Check resource before closing in encryption wrapperVincent Petry2021-12-091-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Switch logical operatorsacsfer2021-12-031-4/+4
| | | | | | | | | | | | Unless there is a good reason to keep actual ones 👀
* | | | background scan the source storage when a background scan on a storage jail ↵Robin Appelman2021-12-022-16/+25
|/ / / | | | | | | | | | | | | | | | is triggered Signed-off-by: Robin Appelman <robin@icewind.nl>
* | | Check for invalid characters before trimmingJoas Schilling2021-11-251-1/+1
| | | | | | | | | | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* | | Fix Guzzle function callsCôme Chilliet2021-11-232-5/+5
| | | | | | | | | | | | | | | | | | | | | Since 1.7.0 and 2.0 these functions are turned into static methods. See https://github.com/guzzle/psr7#upgrading-from-function-api Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | | Fix ArrayAccess and JsonSerializable return typesCôme Chilliet2021-11-232-6/+14
|/ / | | | | | | | | | | First round of modifications for PHP 8.1 Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | Merge pull request #29622 from nextcloud/feat/objectstore_multibucket-shiftVincent Petry2021-11-192-3/+16
|\ \ | | | | | | Implement multibucket shift for ObjectStore
| * | Implement multibucket shift for ObjectStoreJohn Molakvoæ2021-11-112-3/+16
| | | | | | | | | | | | Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
* | | Merge pull request #29758 from nextcloud/disk_free_space-fix-php8Vincent Petry2021-11-191-1/+1
|\ \ \ | | | | | | | | Check for `disk_free_space`
| * | | Check for `disk_free_space`acsfer2021-11-181-1/+1
| |/ / | | | | | | | | | Check for `disk_free_space` before calling it. Fix https://github.com/nextcloud/server/issues/29748
* | | Normalize directory entries in Encoding wrapperVincent Petry2021-11-173-4/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Move storage encoding compatibility warning logicVincent Petry2021-11-172-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Normalize file name before existence check in scannerVincent Petry2021-11-171-0/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | 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>
* | Update lib/private/Files/Storage/Wrapper/Availability.php add void Vincent Petry2021-11-051-1/+1
| | | | | | | | | | Signed-off-by: Vincent Petry <vincent@nextcloud.com> Co-authored-by: Carl Schwan <carl@carlschwan.eu>
* | Return false in hasUpdated when storage is not availableVincent Petry2021-11-051-4/+10
| | | | | | | | | | | | | | | | | | | | 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>
* | Fix psalmJohn Molakvoæ2021-11-041-2/+2
| | | | | | | | Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
* | Merge pull request #29502 from nextcloud/revert-27378-dav-recalc-checksumJohn Molakvoæ2021-11-011-3/+2
|\ \
| * | Revert "add dav plugin to trigger recalculating of checksums"John Molakvoæ2021-11-011-3/+2
| | |
* | | properly handle cases where cache wrappers block accessRobin Appelman2021-11-012-3/+4
| | | | | | | | | | | | | | | | | | `CacheWrapper::formatCacheEntry` can return false for files that should be filtered out Signed-off-by: Robin Appelman <robin@icewind.nl>
* | | Merge pull request #29281 from vijfhoek/masterJohn Molakvoæ2021-11-012-6/+14
|\ \ \ | |/ / |/| |
| * | Move query outside the loop and reduce chunk size to 1000Sijmen Schoon2021-10-172-12/+14
| | | | | | | | | | | | | | | | | | | | | This involved changing CacheQueryBuilder\whereParentIn to take a parameter name, renaming the function accordingly. Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
| * | Limit parameter count per query in Cache.removeChildrenSijmen Schoon2021-10-171-8/+14
| | | | | | | | | | | | Signed-off-by: Sijmen Schoon <me@sijmenschoon.nl>
* | | Merge pull request #27378 from nextcloud/dav-recalc-checksumJohn Molakvoæ2021-11-011-2/+3
|\ \ \
| * | | Add dav plugin to trigger recalculating of checksumsRobin Appelman2021-08-231-2/+3
| | | | | | | | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | | | Merge pull request #29115 from ↵Carl Schwan2021-10-282-1/+9
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | nextcloud/work/carl/correct-permissions-when-copying Fix permissions when copying from ObjectStorage
| * | | | Fix permissions when copying from ObjectStorageCarl Schwan2021-10-282-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | Add type hint to fread_block $blockSize param & apply cs:fix.alanmeeson2021-10-231-2/+2
| | | | | | | | | | | | | | | | | | | | Signed-off-by: alanmeeson <alan@carefullycalculated.co.uk>
* | | | | Fix truncation of files upon read when using object store and encryption.Alan Meeson2021-10-231-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | Merge pull request #27440 from nextcloud/is-file-handleJohn Molakvoæ2021-10-231-4/+4
|\ \ \ \ \
| * | | | | Handle files with is_file instead of file_existsacsfer2021-08-151-4/+4
| | | | | | | | | | | | | | | | | | Should fix things like `fread(): read of 8192 bytes failed with errno=21 Is a directory`
* | | | | | Merge pull request #25392 from nextcloud/imountpoint-ocp-storageJulius Härtl2021-10-223-3/+3
|\ \ \ \ \ \
| * \ \ \ \ \ Merge branch 'master' into imountpoint-ocp-storageJohn Molakvoæ2021-10-22103-1187/+1029
| |\ \ \ \ \ \
| * | | | | | | dont return private storage interface from public mount interfaceRobin Appelman2021-03-233-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | | | | | | | Merge pull request #29220 from nextcloud/s3-external-listJohn Molakvoæ2021-10-222-2/+9
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | |
| * | | | | | | more reliable return value for Watcher::checkUpdateRobin Appelman2021-10-151-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
| * | | | | | | s3 external storage listing reworkRobin Appelman2021-10-151-1/+1
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | | | | | | Merge pull request #26347 from J0WI/clean-path-regexJohn Molakvoæ2021-10-221-4/+4
|\ \ \ \ \ \ \
| * | | | | | | Cleaner normalizePath regexJ0WI2021-03-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: J0WI <J0WI@users.noreply.github.com>
* | | | | | | | Fix security issues when copying groupfolder with advanced ACLCarl Schwan2021-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | | | | | Merge pull request #28768 from nextcloud/check-file-existsJohn Molakvoæ2021-10-181-1/+1
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | |
| * | | | | | | Simplify :)acsfer2021-10-041-1/+1
| | | | | | | |
| * | | | | | | Replace `file_exists()` method by `is_file()`acsfer2021-10-041-1/+1
| | | | | | | |