Commit Graph

586 Commits

Author SHA1 Message Date
Vincent Petry b900782513 Also adjust storage_mtime of target after rename
Some storages like Dropbox change their mtime on rename...
2015-10-26 15:41:23 +01:00
Lukas Reschke 13e817e901 Throw exception on `getPath` if file does not exist
Currently the `getPath` methods returned `NULL` in case when a file with the specified ID does not exist. This however mandates that developers are checking for the `NULL` case and if they do not the door for bugs with all kind of impact is widely opened.

This is especially harmful if used in context with Views where the final result is limited based on the result of `getPath`, if `getPath` returns `NULL` PHP type juggles this to an empty string resulting in all possible kind of bugs.

While one could argue that this is a misusage of the API the fact is that it is very often misused and an exception will trigger an immediate stop of execution as well as log this behaviour and show a pretty error page.

I also adjusted some usages where I believe that we need to catch these errors, in most cases this is though simply an error that should hard-fail.
2015-10-25 17:58:21 +01:00
Jörn Friedrich Dreyer 2895c91291 Merge pull request #17641 from owncloud/fix_objectstore_rename
don't move files in cache twice, fixes renaming for objectstores
2015-10-19 17:18:57 +02:00
Robin Appelman ef179331bb Add tests for double cache rename 2015-10-16 21:41:51 +02:00
Robin Appelman a87368acb9 Skip checkupdate test for swift 2015-10-16 21:41:51 +02:00
Roeland Jago Douma d8798877df Added test for rmdir on moveablemount 2015-10-16 16:51:44 +02:00
Bjoern Schiessle 8185eaa6dd also detect files in a .part folder as part file 2015-10-12 13:59:16 +02:00
Jörn Friedrich Dreyer c8640cdcb0 adjust filesystem tests to objectstore 2015-10-09 12:35:37 +02:00
Thomas Müller 17ffa4a244 Merge pull request #19414 from owncloud/swift_primary_storage_tests
Swift primary storage tests
2015-10-08 14:08:56 +02:00
Jörn Friedrich Dreyer 5646e39248 test objectstore with ceph docker
use default config for swift primary storage test config

allow testsuite to complete

fix timeout, script cleanup, enable debug for now

use btrfs loopback device, requires privileged container and absolute path

throw exception when storage has problems

debug by echo ...

sleep more, more debug
2015-10-06 16:27:25 +02:00
Robin Appelman e28a2ff888 Add unit test for searching in storage root 2015-10-06 15:54:17 +02:00
Thomas Müller 56c35da8d5 Merge pull request #19416 from owncloud/node-hook-connector
pass view hooks trough to the node hooks
2015-10-05 10:25:04 +02:00
Vincent Petry 64ca00925b Prevent moving mount point into already shared folder (outgoing)
It is already not allowed to share a folder containing mount points /
incoming shares.

This fixes an issue that made it possible to bypass the check by moving
the incoming share mount point into an existing outgoing share folder.
2015-10-02 16:14:42 +02:00
Bjoern Schiessle e7232a848b versions should always use the keys of the original file, no need to create new one 2015-10-01 10:10:19 +02:00
Robin Appelman e21a025887 remove unused use 2015-09-28 17:20:44 +02:00
Robin Appelman 1e5a41f008 Add hook connector to connect view and node hooks 2015-09-28 17:18:40 +02:00
Thomas Müller bf4c144c6f Merge pull request #19335 from owncloud/phil-davis-view-typos
Comment typos in tests/lib/files/view.php
2015-09-24 14:54:21 +02:00
Thomas Müller 330ea18996 Merge pull request #19303 from owncloud/usecorrectvariable
Use correct variable
2015-09-24 11:34:19 +02:00
Phil Davis 9f9bdd8f90 Comment typos in tests/lib/files/view.php
Correct a comment typo just introduced at line 892, plus another and some white space at EOL.
2015-09-24 15:01:45 +05:45
Thomas Müller df75c17e52 Merge pull request #16479 from owncloud/core-fixgetrelativepathwrongmatches
Prevent wrong matches in getRelativePath
2015-09-24 10:25:00 +02:00
Jörn Friedrich Dreyer 17ef187681 add is* storage tests 2015-09-23 23:41:39 +02:00
Thomas Müller bcdb3c26da Merge pull request #19236 from owncloud/call_dot_directories_function
Replaces if ($file === '.' || $file === '..') by public function call isIgnoredDir
2015-09-23 11:34:23 +02:00
Thomas Müller ad71d92acf Merge pull request #19247 from owncloud/fix_locking_copy_operation
locking: handle exceptions correctly during copy operation
2015-09-23 11:28:27 +02:00
Martin 491250320a Replaces if ($file === '.' || $file === '..') by if(\OC\Files\Filesystem::isIgnoredDir($file)). Eases to find where this operation is used. 2015-09-22 17:53:15 +02:00
Lukas Reschke 63b2bc136a Move mimetype files into /resources/config/ 2015-09-22 16:43:28 +02:00
Joas Schilling d26c49b995 Add more tests for relativePath 2015-09-22 11:34:37 +02:00
Vincent Petry b9cd5bc1dc Prevent wrong matches in getRelativePath
Before this fix, the root "/files" with path "/files_trashbin" would
return "_trashbin" as relative path...
2015-09-22 11:34:37 +02:00
Bjoern Schiessle 17a64360e5 catch excexptions during the copy operation and make sure that we free the lock correctly 2015-09-22 11:32:10 +02:00
Lukas Reschke 36ce254ffd Move dummy backend to Tests namespace 2015-09-22 11:01:11 +02:00
Bjoern Schiessle 9bd4f2d41e occ script to disable encryption and to decrypt all files again 2015-09-15 22:39:44 +02:00
Robin Appelman 9f11b27797 Use the view logic for getFolderContent for the node api 2015-09-08 22:38:50 +02:00
Robin McCorkell c6314fc699 Unit tests for mimetype loader 2015-09-04 17:37:10 +01:00
Björn Schießle 6e210d960c Merge pull request #18423 from owncloud/occ_encrypt_all
occ command line tool to encrypt all files
2015-08-28 20:44:55 +02:00
Bjoern Schiessle e51fe617d8 copy always file by file to encrypt/decrypt it if needed 2015-08-26 14:58:22 +02:00
Bjoern Schiessle 8c08dd0ac2 occ tool to encrypt all files 2015-08-26 14:58:22 +02:00
Robin McCorkell 3b27603762 Revert "Fix mounting wrapped storages resulting in many-layered wrapping"
This reverts commit 75a5e6e12b.
2015-08-19 14:41:43 +01:00
Thomas Müller d5bba42030 Merge pull request #17932 from owncloud/fix_move_files
make sure that hooks are emitted properly on file move operation
2015-08-11 13:54:09 +02:00
Morris Jobke ca8f7fd69c Merge pull request #18124 from owncloud/share-permwrongvar
Fix removal of share permissions when share disabled for user
2015-08-07 18:42:35 +02:00
Vincent Petry b3a1aef934 Merge pull request #13641 from owncloud/cache-storage-status
Store storage availability in database
2015-08-07 17:31:03 +02:00
Vincent Petry 143e4a81f0 Fix removal of share permissions when share disabled for user 2015-08-07 15:43:27 +02:00
Bjoern Schiessle 51a67a54e0 always update file cache, the cache can handle partial data correctly if the file doesn't already exists in the file cache 2015-07-31 17:14:32 +02:00
Thomas Müller 22fd04eb41 Merge pull request #17981 from owncloud/correct-regex
Correct regular expressions
2015-07-30 16:07:46 +02:00
Lukas Reschke 52cd4efc83 Add more unit tests 2015-07-30 11:25:05 +02:00
Lukas Reschke ad4c731c4c Correct regular expressions
Previously the regex was only matching on single characters. Meaning that file names such as "👍.txt" where possible while "👍" alone never was. This check apparently never worked as expected.
2015-07-30 11:22:14 +02:00
Robin McCorkell 3ef680d966 Merge pull request #17950 from owncloud/config-dontdetectfschangesinrootbydefault
Disable filesystem_check_changes by default
2015-07-29 15:34:02 +01:00
Vincent Petry 943fc1b8e5 Fix watcher tests to explicitly set policy 2015-07-29 15:10:42 +02:00
Bjoern Schiessle fb4c99fe06 make sure that we emit the hooks if a file gets moved from a subfolder to the root folder with the nodes API 2015-07-29 11:02:38 +02:00
Morris Jobke c34e63bb1f Merge pull request #15543 from rullzer/mimetypedetector
Mimetypedetector
2015-07-28 13:35:26 +02:00
Thomas Müller 68f14a943a Merge pull request #17840 from owncloud/fix-enc-wrapper-without-encryption
Only set is encrypted when encryption is enabled
2015-07-27 16:06:39 +02:00
Roeland Jago Douma d276aebf40 Pass config dir as parameter to detection class
In order to properly test the mimetype function:

* constructor takes path to configdir
* Added unit tests for mimetype (only if vfsStream is available)
2015-07-27 14:59:49 +02:00
Roeland Jago Douma 9cdd637050 Loading of mapping/aliases is done in class 2015-07-27 14:59:49 +02:00
Roeland Jago Douma 141a0f0f47 Move mimetypedetection to files/type/detection 2015-07-27 14:59:45 +02:00
Roeland Jago Douma 6db6689740 Added mimetype detector
* Copied unit tests from old functions
2015-07-27 14:58:45 +02:00
Lukas Reschke c20d4d1a0b Add unit tests 2015-07-27 11:21:49 +02:00
Joas Schilling 42baeb36dc Add a unit test for the disabled encryption case 2015-07-23 17:01:44 +02:00
Robin McCorkell 75a5e6e12b Fix mounting wrapped storages resulting in many-layered wrapping
This usually doesn't cause issues, but in unit tests sometimes a wrapped
storage is passed to Filesystem::mount() and gets rewrapped, hitting the
XDebug function nesting level limit when used.
2015-07-20 16:27:26 +01:00
Robin McCorkell df19cabb44 Store storage availability in database
Storage status is saved in the database. Failed storages are rechecked every
10 minutes, while working storages are rechecked every request.

Using the files_external app will recheck all external storages when the
settings page is viewed, or whenever an external storage is saved.
2015-07-20 16:27:26 +01:00
Bjoern Schiessle a2e2005e67 make sure that we always detect legacy files correctly 2015-07-17 13:30:08 +02:00
Thomas Müller 9120942bcf Merge pull request #16924 from owncloud/copy-recursive-polyfill
add recursive copy polyfill for storage backends
2015-07-06 17:05:36 +02:00
Thomas Müller f55aa856ad Remove file mapper - was only use in Windows and never worked properly 2015-07-03 15:41:29 +02:00
Robin Appelman a0c089a1c9 add unit tests 2015-07-03 13:44:03 +02:00
Morris Jobke f5c57e076e Merge pull request #17077 from owncloud/files-scan-absolute-path
fix getting mount points when passing a path to the files:scan command
2015-07-02 13:02:20 +02:00
Vincent Petry 167f57c15e Unlock first path on rename if second path is locked 2015-06-29 17:31:14 +02:00
Joas Schilling 70eb20e3a7 Merge pull request #17030 from owncloud/lock-posthooks
Keep shared lock for post-hooks
2015-06-29 14:17:03 +02:00
Robin Appelman 786ec82a61 add unit test 2015-06-29 14:06:29 +02:00
Vincent Petry 271ef9dedb Remove test-specific method to make Bjoern and Joas happy 2015-06-26 17:37:04 +02:00
Joas Schilling 9b336765b6 Correctly check if the real file exists, otherwise try the part file 2015-06-26 13:17:23 +02:00
Vincent Petry 538e466c30 Keep shared locks in post hooks
Instead of unlocking after the file operation, change exclusive locks
back to shared locks during post hooks, and unlock after that.

Also added unit tests to test locking in pre-hooks, during operation and
post-hooks.
2015-06-25 16:33:02 +02:00
Vincent Petry 58439c337c Merge pull request #17070 from owncloud/lock-movemountbug
Lock correct paths when moving mount
2015-06-24 18:37:48 +02:00
Vincent Petry 35047a2300 Fix locked paths in the moveMount case
When moving a mount point directly, the lock must be applied on the
local mount point path instead of the attached storage root.

Other operations will still lock the attached storage root.
2015-06-24 11:33:28 +02:00
Björn Schießle cce841c665 Merge pull request #17045 from owncloud/enc_improvements
encryption improvements
2015-06-23 14:30:21 +02:00
Bjoern Schiessle 95602d4069 make sure that we always read the header from the original file 2015-06-23 11:41:21 +02:00
Thomas Müller ced15c44b4 Merge pull request #16657 from owncloud/view-emit-path
emit hooks from a view as long as the path is inside the default root
2015-06-22 11:29:11 +02:00
Vincent Petry e15dd783ab Workaround for empty dir deletion for SFTP
Explicitly clear the stat cache after deleting an empty folder to make
sure it is properly detected as deleted in subsequent requests.

This works around a problem with phpseclib where the folder is properly
deleted remotely but the stat cache was not updated.
2015-06-18 17:40:38 +02:00
Vincent Petry 102c6ffc41 Normalize path in View's lock methods 2015-06-16 17:03:12 +02:00
Vincent Petry 0e3a3dd5d7 Rethrow LockedException with full path
Because the path is converted to md5 from the original exception,
rethrow the exception with the correct full path
2015-06-16 10:48:31 +02:00
Joas Schilling a7d2b3b9ae Add return value to lock methods and check it in tests 2015-06-12 11:41:05 +02:00
Thomas Müller a968b8409d Merge pull request #16158 from owncloud/mountprovider-after-setup
Call newly registered mount providers after the filesystem is setup
2015-06-08 13:42:02 +02:00
Joas Schilling bb0cb0aaec Merge pull request #15895 from owncloud/dav-getremoteetag
Get etag from remote OC server
2015-06-03 17:20:25 +02:00
Joas Schilling d3e3a84cae Move the helpful method to the TestCase class 2015-06-03 12:33:29 +02:00
Vincent Petry 120588dd7a Disable update check test when testing wrappers
The checkUpdate test is intended for testing real storages, not
wrappers.
2015-06-02 15:14:37 +02:00
Robin Appelman 8926bca0c7 phpdoc, strict and type hints 2015-06-02 14:07:55 +02:00
Robin Appelman 24131586d7 call mount providers that are registered after the filesystem is setup 2015-06-02 14:07:54 +02:00
Robin Appelman 4b48dd424f emit hooks from a view as long as the path is inside the default root 2015-06-02 14:07:20 +02:00
Vincent Petry c4cb93e644 Added storage backend test for checkUpdate
This helps testing whether checkUpdate properly returns false when no
change exists
2015-06-02 11:42:03 +02:00
Robin Appelman d519aba878 fix test 2015-06-01 13:22:56 +02:00
Robin Appelman 7e418c7d69 high level locking wip 2015-06-01 13:22:56 +02:00
Thomas Müller c700f42b68 Merge pull request #16517 from owncloud/remove-logo-wide
replace logo-wide on share page as well with better icon + text
2015-05-29 12:15:02 +02:00
Vincent Petry e114d00242 Only use quota stream wrapper on "files"
Prevent using the quota stream wrapper on trashbin folders and other
metadata folders
2015-05-28 18:31:20 +02:00
Vincent Petry ded62ff693 Merge pull request #16501 from owncloud/enc_fix_move_versions_between_storages
[encryption] fix move versions between storages
2015-05-28 15:28:25 +02:00
Björn Schießle ab0747113c Merge pull request #16452 from owncloud/enc_ftp_upload
always write file, if fseek doesn't work we write the whole file
2015-05-26 12:02:41 +02:00
Bjoern Schiessle c63f2286c0 copy keys before we move a file between storages to make sure that the new target file reuses the old file key, otherwise versions will break 2015-05-22 15:41:28 +02:00
Jan-Christoph Borchardt 4e93d9e3a2 remove logo-wide from tests 2015-05-21 22:40:26 +02:00
Bjoern Schiessle 5a20edac82 test to simulate a non-seekable stream wrapper 2015-05-21 14:15:26 +02:00
Vincent Petry 22968e806c Get correct mimetype when moving and changing extension
Fixes issue when restoring folders from trash cross-storage, as such
folders have an extension ".d12345678".

Fixes issue when moving folders between storages and at the same time
changing their extension.
2015-05-21 10:57:58 +02:00
Morris Jobke 39d1e99228 Merge pull request #16322 from owncloud/trash-view
dont go trough the view when moving to trash
2015-05-20 14:44:01 +02:00
Robin Appelman 2213d6597c add tests for copyFromStorage with same storage 2015-05-19 17:30:32 +02:00
Scrutinizer Auto-Fixer fdbc21fc6c Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-05-19 11:23:06 +00:00
Björn Schießle 1c411baf17 Merge pull request #16412 from owncloud/jknockaert-patch-1
fix #16356
2015-05-18 19:26:40 +02:00
Clark Tomlinson f9b6ee86cd Merge pull request #16399 from owncloud/enc_rmdir_fix
[encryption] only try to delete file keys if it is a valid path
2015-05-18 11:09:36 -04:00