aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #24596 from kofemann/dcache-wormVincent Petry2022-09-161-0/+14
|\ | | | | make NextCloud WORM file system friendly
| * config: add a switch to control truncate before updateTigran Mkrtchyan2022-09-161-6/+12
| | | | | | | | | | | | | | | | | | To avoid extra truncate on non WORM file systems, add a new config option `localstorage.unlink_on_truncate`, which defaults to false. The OC\Files\Storage\Local is update to respect that option. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
| * files: remove destination file before copying new content (WORM)Tigran Mkrtchyan2022-09-161-0/+2
| | | | | | | | Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
| * files: make OC\Files\Storage\Local WORM friendlyTigran Mkrtchyan2022-08-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some filesystems run as a Write-Once-Read-Many storages. This makes them impossible to use with NexeCloud, as the file system layers uses `truncate` syscall (through file_put_contents function). As Nextcloud is never updates existing files, removing the old entry and creatint a new one on update will allow NextCoud to update on such file systems. Update Local#fopen and Local#file_put_contents to remote existing file before truncating. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
* | Switch logical operators (and|or)Git'Fellow2022-09-121-18/+12
| | | | | | Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
* | get quota for user only when neededRobin Appelman2022-09-011-20/+51
|/ | | | | | always apply the wrapper but have the wrapper get the quota lazily only when an operation where quota is applied is performed Signed-off-by: Robin Appelman <robin@icewind.nl>
* Move CappedMemoryCache to OCPCarl Schwan2022-07-141-1/+1
| | | | | | | | 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>
* Merge pull request #31475 from nextcloud/kofemann-patch-1blizzz2022-06-211-0/+1
|\ | | | | files: close open directory file descriptor on error path
| * files: close open directory file descriptor on error pathTiramisu Mokka2022-03-071-0/+1
| |
* | Merge pull request #31966 from nextcloud/unencrypted-sizeVincent Petry2022-06-131-40/+58
|\ \ | | | | | | store unencrypted size in the unencrypted_size column
| * | store unencrypted size in the unencrypted_size columnRobin Appelman2022-06-021-40/+58
| | | | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | | Expose umask override value as config parameter: localstorage.umaskMartin Brugnara2022-06-051-5/+9
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 451c06d introduced override for umask value. This is needed to avoid broken env configuration or dirty workers to mess with the permissions when creating new files. Most Nextcloud, that does not integrate with external software would work fine with an hard-coded value (451c06d set it at 022). Advanced install may require more flexibility, as such this commit exposes the "umask override value" as configuration parameter: `localstorage.umask` It defaults to 0022 both in code and in config/config.sample.php . Signed-off-by: Martin Brugnara <martin@0x6d62.eu>
* | composer run cs:fixCôme Chilliet2022-04-261-1/+0
| | | | | | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | Remove ILogger usages in lib/private/Files/StorageCôme Chilliet2022-04-263-19/+25
| | | | | | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | ignore forbidden files while scanning local storageRobin Appelman2022-04-201-1/+5
| | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | use the same cached propfind for free space for dav storageRobin Appelman2022-04-041-2/+2
| | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* | Merge pull request #31632 from Maaxxs/fix-undefined-index-davLouis2022-03-291-3/+6
|\ \ | | | | | | Fixes the undefined index error with the DAV property getlastmodified
| * | Use the null coalescing operator to set the value of `size`.Max Kunzelmann2022-03-281-1/+1
| | | | | | | | | | | | Signed-off-by: Max Kunzelmann <maxdev@posteo.de>
| * | Set `mtime` to null instead of false if `getlastmodified` does not exist.Max Kunzelmann2022-03-231-1/+1
| | | | | | | | | | | | Signed-off-by: Max Kunzelmann <maxdev@posteo.de>
| * | Fix typo.Max Kunzelmann2022-03-201-1/+1
| | | | | | | | | | | | Signed-off-by: Max Kunzelmann <maxdev@posteo.de>
| * | Fixes the undefined index error with the DAV property getlastmodifiedMax Kunzelmann2022-03-201-2/+5
| | | | | | | | | | | | Signed-off-by: Max Kunzelmann <maxdev@posteo.de>
* | | Fixing psalm errorsCôme Chilliet2022-03-241-9/+9
| | | | | | | | | | | | | | | | | | Encryption constructor is problematic and should still be fixed later. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | | Migrate from ILogger to LoggerInterface in lib/privateCôme Chilliet2022-03-241-26/+14
|/ / | | | | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* / some file scanner performance improvementsRobin Appelman2022-03-172-5/+20
|/ | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Remove redundant if clauseCôme Chilliet2022-01-251-4/+1
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Fix OC\Files\Storage\DAV::hasUpdated when cache is not setCôme Chilliet2022-01-251-1/+1
| | | | | | | Fixes the test OCA\Files_External\Tests\Storage\WebdavTest::testStat on PHP>=7.4 Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Merge pull request #30631 from nextcloud/fix/update_encrypted_versionVincent Petry2022-01-141-1/+10
|\ | | | | updateEncryptedVersion: cleanup on target if cache already got renamed
| * updateEncryptedVersion: cleanup on target if cache already got renamedJonas Meurer2022-01-121-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When moving a file to trash with encryption enabled, the cache gets moved before the actual file. According to @icewind1991 this is in order to not break object storage. When moving a file from an unencrypted storage (e.g. a collectives storage) to the encrypted trashbin storage, this causes errors, see This commit fixes it by doing `updateEncryptedVersion()` on the target cache entry *if* the source cache entry doesn't exist anymore, but the corresponding target cache entry does exist already. Fixes: #26544 Signed-off-by: Jonas Meurer <jonas@freesources.org>
* | Fix psalm issuesCarl Schwan2022-01-131-6/+6
| | | | | | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* | Add helper method in WrapperCarl Schwan2022-01-131-1/+20
|/ | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Fix fail when keys/files folder already existsVincent Petry2022-01-101-1/+5
| | | | | | | | | Fixes an issue with transfer ownership in move mode where the folder "files_encryption/keys/files" already exists. Instead of failing, its existence is checked before calling mkdir. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
* 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>
* Check for invalid characters before trimmingJoas Schilling2021-11-251-1/+1
| | | | Signed-off-by: Joas Schilling <coding@schilljs.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-172-3/+66
|/ | | | | | | | | | | | 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>
* 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>
* 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 branch 'master' into imountpoint-ocp-storageJohn Molakvoæ2021-10-2220-330/+61
|\ \
| * | 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
| | | |
| | * | Get `filesize()` if `file_exists()`acsfer2021-10-011-1/+1
| | |/ | | | | | | Should make sense.
| * | Merge pull request #27194 from nextcloud/new-ftpJohn Molakvoæ2021-10-141-7/+7
| |\ \
| | * | make param names consistent with interface for copy directory polyfillRobin Appelman2021-10-071-7/+7
| | |/ | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>