Commit Graph

370 Commits

Author SHA1 Message Date
Roeland Douma 4ddf9f98f1 Don't calculate permissions twice (#23917)
There is no need to calculate the permissions twice.
Saves some is_dir and file_exists calls.
2016-04-12 09:45:59 +02:00
Thomas Müller e2c4a0cecd Merge pull request #23860 from owncloud/followup-23304-opening-empty-file
Correctly return an empty string for empty files
2016-04-11 10:08:24 +02:00
Joas Schilling 178ad23d80
Correctly return an empty string for empty files 2016-04-08 14:50:42 +02:00
Stefan Weil b1a856d7b7 lib: Fix typos (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-04-07 19:51:27 +02:00
Morris Jobke 6ecd1d9e86 Fix PHP memory leak in file_get_contents()
* ref https://bugs.php.net/bug.php?id=61961

* ref https://github.com/owncloud/core/issues/20261#issuecomment-180000256

* code is based on the proposal of @chriseqipe

* fixes #20261
2016-04-04 16:48:09 +02:00
Bjoern Schiessle e4b451491b make sure that we always remove the file again from the cache after the version was created 2016-03-31 21:52:23 +02:00
Frank Karlitschek f5709b511b Merge pull request #23445 from owncloud/enc_small_improvement
small performance improvement: no need to calculate the header size
2016-03-31 20:38:42 +02:00
Frank Karlitschek 2bff34be56 Merge pull request #23707 from owncloud/make-sure-that-encrypted-version-is-set
Make sure that the encrypted version is set
2016-03-31 20:37:17 +02:00
Bjoern Schiessle 93ed965cbb fix creation of versions of encrypted files on external storages
in order to create a 1:1 copy of a file if a version gets created
we need to store this information on copyBetweenStorage(). This
allows us to by-pass the encryption wrapper if we read the source file.
2016-03-31 19:24:47 +02:00
Lukas Reschke c427bf3b5d Make sure that the encrypted version is set
The code path called when using external storage with WebDAV is using `\OC\Files\Storage\Wrapper\Encryption::getMetaData` which did not contain the actual encrypted version inside the cache entry version. This lead to the following:

1. User uploaded a file
2. File is created and `\OC\Files\Storage\Wrapper\Encryption::getMetaData` is called. It has an empty `encryptedVersion` but sets `encrypted` to either `true` or `false`.
3. The call when updating the file cache will use the old version.
2016-03-31 18:06:37 +02:00
Bjoern Schiessle 7b9d53b7ea no need to calculate the header size, if the first block contain a header we already know the size 2016-03-21 15:47:24 +01:00
Lukas Reschke 676041ba7e Ensure that stored version is at least 1 for cross-storage copy
In case of a move operation from an unencrypted to an encrypted
storage the old encrypted version would stay with "0" while the
correct value would be "1". Thus we manually set the value to "1"
for those cases.

See also https://github.com/owncloud/core/issues/23078
2016-03-16 10:36:15 +01:00
Thomas Müller 0f6ea9fd29 Merge pull request #23039 from owncloud/invalid-share-storage
dont break when there is an invalid share
2016-03-15 12:15:05 +01:00
Lukas Reschke d43051f7de Verify the getResponse returns a ResponseInterface
Can also return `null` as per PHPDoc. Regression added by 97f5c095f4

Fixes https://github.com/owncloud/core/issues/23145
2016-03-12 22:45:07 +01:00
Robin Appelman a8db587b1f move failedstorage to core 2016-03-11 13:15:45 +01:00
Vincent Petry 89881ed511 Fix call to disk_free_space when a file is provided
In the case of shared files, we have to call free_space() on the file
name. This has the side-effect that when uploading to a local storage
without quota set, it will call disk_free_space with the file name,
which fails.

This fix uses the parent folder in case the given path is a file.
2016-03-07 11:01:24 +01:00
Thomas Müller b56dbd0607 Merge pull request #22816 from owncloud/external-unavailable-recheck
allow availability recheck for external storages
2016-03-04 15:29:17 +01:00
Robin Appelman 6990100e6e allow availability recheck for external storages 2016-03-03 14:19:34 +01:00
Lukas Reschke 72c8187cbb Keep "encryptedVersion" when calling `\OC\Files\View::copy`
When calling `\OC\Files\View::copy` we should also keep the version to ensure that the file will always have the correct version attached and can be successfully decrypted.

To test this the following steps are necessary (from https://github.com/owncloud/core/issues/22781#issuecomment-191328982):

1. setup a new ownCloud 9.0 beta2
2. enable encryption
2. upload a docx (5.7MB large)
3. upload the same file again and overwrite the existing file
4. I can download the original file and the first version
5. I restore the first version
6. restored version can no longer be downloaded with the error described above

The manual cache operation in `\OCA\Files_Versions\Storage` is unfortunately necessary since `\OCA\Files_Versions\Storage::copyFileContents` is not using `\OCP\Files\Storage::moveFromStorage` in the case when an object storage is used. Due to the workaround added in 54cea05271 the stream is directly copied and thus bypassing the FS.
2016-03-03 14:15:36 +01:00
Lukas Reschke c353d51810 Remove Scrutinizer Auto Fixer 2016-03-01 17:48:23 +01:00
Lukas Reschke 933f60e314 Update author information
Probably nice for the people that contributed to 9.0 to see themselves in the AUTHORS file :)
2016-03-01 17:25:15 +01:00
Robin Appelman 003a686c1b ignore encryption keys for propagation 2016-02-29 17:47:09 +01:00
Thomas Müller 914ac09aae Merge pull request #22636 from owncloud/fix-ssl-on-external-storages
Fix HTTPS support on external storages
2016-02-25 14:36:00 +01:00
Thomas Müller efc966698f Merge pull request #22579 from owncloud/fix_broken_unencrypted_size
Heal unencrypted file sizes at download time (second approach)
2016-02-25 14:34:48 +01:00
Lukas Reschke bf4a038535 Add proxy support to external storage
Otherwise debugging issues is a PITA
2016-02-24 19:48:47 +01:00
Bjoern Schiessle 834b51b83b recalculate unencrypted size if we assume that the size stored in the db is not correct 2016-02-23 15:09:46 +01:00
Vincent Petry a9e0cfad8b Check delete permission before attemping copy+delete
Some move operations when cross-storage will be replaced by copy and
delete. Before attempting this, first check whether the source storage
has delete permissions.

This also prevents renaming system-wide external storages.
2016-02-19 12:59:10 +01:00
Thomas Müller 2a9b0aaaa1 Merge pull request #22482 from owncloud/getowner-cache
cache result for getowner
2016-02-18 16:45:40 +01:00
Joas Schilling 6374472e2e No more static 2016-02-18 10:12:23 +01:00
Robin Appelman f309bc960d cache result for getowner 2016-02-17 19:14:46 +01:00
Vincent Petry 8f96ef147f Don't apply quota in stream wrapper for part files
When overwriting shared files as recipient, the part file is written on
the uploader's storage before overwriting the target file.

If the uploader has no quota left, they should still be able to
overwrite that file with Webdav. To make this work, they need to be able
to write the part file to their own storage first.
2016-02-17 11:52:49 +01:00
Bjoern Schiessle 9dc759b4dc remember signature version and only set it on update to make sure that other
apps like files_versions still get the old signature version
2016-02-10 13:27:32 +01:00
Vincent Petry 3736f13826 Check if partial cache entry or not in encryption wrapper 2016-02-09 23:43:27 +01:00
Lukas Reschke 5ccb9dfa7e Use database for keeping track of the version 2016-02-09 23:43:27 +01:00
Björn Schießle cf3a8f274f make it backward compatible to work with signed and un-signed files 2016-02-09 23:43:25 +01:00
Vincent Petry 19980be116 Fix part file partial cache logic in encryption code
The encryption code uses partial cache entries for the part file (which
are not stored in the database) but are useful for other parts of the
code to retrieve the file size again.

This means that in the fixed code $info was empty, so getData() could
not be called.

The fix makes sure to support both cases when the cache entry exists and
doesn't.
2016-02-09 09:47:34 +01:00
Robin Appelman fb76d7de69 remove unused Storage->getLocalFolder 2016-02-05 16:48:08 +01:00
Scrutinizer Auto-Fixer 466a085253 Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2016-02-05 09:38:43 +00:00
Robin Appelman bdf51d9ea4 only trigger locking on lockingstorages 2016-01-14 13:01:43 +01:00
Robin Appelman 0724ac1e5e split locking related methods to their own interface 2016-01-14 12:54:42 +01:00
Robin Appelman d2c579e167 fix quota wrapper 2016-01-14 12:54:42 +01:00
Robin Appelman 6d321f5f6b Return a class from cache operations instead of an array 2016-01-14 12:54:42 +01:00
Thomas Müller 682821c71e Happy new year! 2016-01-12 15:02:18 +01:00
Morris Jobke a18c0983d5 Use TempManager instead of tmpFile 2015-12-18 11:25:33 +01:00
Morris Jobke 90b0831cec Use TempManager instead of tmpFolder 2015-12-18 11:19:53 +01:00
Morris Jobke ecdf88e41b Use proper public API for OC_Helper::getFileNameMimeType 2015-12-17 17:07:48 +01:00
Thomas Müller ecc3c174a0 Merge pull request #21128 from owncloud/dav-fopen-non-existing
Dont do a seperate request to check if a file exists when downloading a file from dav external storage
2015-12-11 10:48:22 +01:00
Robin Appelman 97f5c095f4 Dont do a seperate request to check if a file exists for dav->fopen 2015-12-10 17:23:53 +01:00
Vincent Petry 4b68dd372d Do not check storage availability for getOwner
Because the owner is always known thanks to the file cache and other
places, we don't need the remote storage to be actually available.
2015-12-09 17:31:14 +01:00
Vincent Petry e241d26316 Compute share permissions in the view
The share permissions are now computed in the View/FileInfo instead of
storing them directly/permanently on the storage
2015-12-08 13:04:22 +01:00