Commit graph

99 commits

Author SHA1 Message Date
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
Roeland Jago Douma
d8798877df Added test for rmdir on moveablemount 2015-10-16 16:51:44 +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
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
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
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
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
Vincent Petry
143e4a81f0 Fix removal of share permissions when share disabled for user 2015-08-07 15:43:27 +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
Vincent Petry
167f57c15e Unlock first path on rename if second path is locked 2015-06-29 17:31:14 +02:00
Vincent Petry
271ef9dedb Remove test-specific method to make Bjoern and Joas happy 2015-06-26 17:37:04 +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
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
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
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
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
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
Robin Appelman
e302213248 add unit tests for null handling in view 2015-04-22 16:24:25 +02:00
Robin Appelman
0772e3b4c1 Properly handle copy/move failures in cross storage copy/move 2015-04-13 15:13:03 +02:00
Robin Appelman
31e94708f8 Improve cross storage copy between local storages 2015-04-13 15:13:02 +02:00
Vincent Petry
f8cfc03f36 Replace originalStorage in tests with a proper teardown
The purpose of $originalStorage in unit tests was to remount the old
root.
However that storage itself is already wrapped by storage wrapper, so
remounting it would rewrap the storage several times.

This fix makes use of "loginAsUser()" and "logout()" from the TestCase
class to properly initialize and cleanup the FS as expected.
2015-04-08 12:45:38 +02:00
Robin Appelman
7ab919256b fix test 2015-03-16 14:13:56 +01:00
Robin Appelman
169031d1c5 fix factory test 2015-03-11 15:07:59 +01:00
Robin Appelman
e1f2a6df94 Allow setting the watcher policy as mount option 2015-03-11 15:07:23 +01:00
Robin Appelman
7adda88786 Copy mount options to the storage 2015-03-11 15:06:48 +01:00
Robin Appelman
fc027bceb7 Fix cache update when doing a rename that overwrites the target 2015-02-27 16:39:58 +01:00
Vincent Petry
232de3bdc0 Delete target file for unsuccessful copy/rename 2015-02-26 15:11:37 +01:00
Lukas Reschke
41e5850450 Prevent directory traversals in ctr of \OC\Files\View
This prevents a misusage of \OC\Files\View by calling it with user-supplied input. In such cases an exception is now thrown.
2015-02-18 18:17:33 +01:00
Bjoern Schiessle
21c45925fe detect root of mountpoint also if the trailing slash is missed 2015-02-04 12:47:04 +01:00
Robin Appelman
2124540d1d Dont remove a file from cache if the delete operation failed 2015-01-29 15:39:56 +01:00
Robin Appelman
ddee63fa00 Fix resolving paths for views rooted in a file 2015-01-29 12:47:11 +01:00
Robin Appelman
87a1b2bdc4 Preserve mtime when doing cross storage move 2015-01-23 15:11:27 +01:00
Robin Appelman
96dff341e2 Return valid fileinfo objects for part files 2015-01-13 13:59:28 +01:00
Thomas Müller
d648b548eb skip testLongPath() 2014-12-10 12:20:30 +01:00
Joas Schilling
ea4c25609d Replace uniqid calls with $this->getUniqueID so tests pass again on windows 2014-12-03 12:10:55 +01:00
Joas Schilling
bb540722cd Use base class to reset the file mapper 2014-11-19 14:52:07 +01:00
Morris Jobke
146cb920c9 Merge pull request #12218 from owncloud/issue/10991-fixes
Issue/10991 Make unit tests pass on windows
2014-11-17 16:44:45 +01:00
Joas Schilling
6625d5c88f Correctly restore previous root mount point after testing 2014-11-17 10:48:19 +01:00
Joas Schilling
a3a064fe96 Skip some more tests on Windows which just can not work at all 2014-11-17 10:48:06 +01:00
Robin Appelman
d26a427f92 Also propagate etag changes when the watcher finds a changed file 2014-11-07 12:56:09 +01:00
Robin Appelman
16cfca6a5f Better reuse of cache data for getFolderContents 2014-10-24 12:33:54 +02:00
Clark Tomlinson
6de8531ace fixing windows max depth test 2014-09-30 16:04:49 -04:00
Robin Appelman
3d92f963f4 Fix unit test 2014-09-05 11:53:23 +02:00