Commit graph

441 commits

Author SHA1 Message Date
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
Robin Appelman
6ecfcde954 update test 2015-02-13 15:01:05 +01:00
Robin Appelman
134243d3e5 Dont lower the mtime of a folder when propagating changes 2015-02-13 14:30:05 +01:00
Lukas Reschke
4d91fa4c93 Normalize before processing 2015-02-06 15:03:29 +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
cec43df0f0 Add unit test 2015-01-28 13:44:39 +01:00
Morris Jobke
752b94d363 Merge pull request #13717 from owncloud/storage-donotwrapnullstorage
Prevent wrapping null storage
2015-01-28 01:00:20 +01:00
Vincent Petry
6d8985b671 Prevent wrapping null storage
Can happen when trying to instantiate external storages that have
incomplete config, where the constructor throws an exception (the
exception is caught in createStorage())
2015-01-27 17:40:08 +01:00
Robin Appelman
87a1b2bdc4 Preserve mtime when doing cross storage move 2015-01-23 15:11:27 +01:00
Robin Appelman
0a3e0a1665 Additional unit test for recursive remove 2015-01-15 18:47:05 +01:00
Thomas Müller
337c43ce92 Merge pull request #13317 from owncloud/partfile-fileinfo
Return valid fileinfo objects for part files
2015-01-14 22:39:19 +01:00
Robin Appelman
96dff341e2 Return valid fileinfo objects for part files 2015-01-13 13:59:28 +01:00
Vincent Petry
fcc3b3d5f7 Fix searchCommon to properly match path name
The internal path was matched without the last "/" which caused
"files_trashbin" to also match when the internal path was "files".

This adds the missing slash for the comparison.
2015-01-12 19:33:00 +01:00
Lukas Reschke
05615bfd47 Simplify isValidPath and add unit tests
The check for invalid paths is actually over-complicated and performed twice resulting in a performance penalty. Additionally, I decided to add unit-tests to that function.

Part of https://github.com/owncloud/core/issues/13221
2015-01-10 00:40:21 +01:00
Vincent Petry
aa821ecc00 Trim leading or trailing slashes in file cache paths 2015-01-08 19:43:02 +01:00
Thomas Müller
fe6f4a1404 Merge pull request #11810 from owncloud/hhvm-autotest
Adding autotest-hhvm.sh [WIP]
2014-12-22 14:12:03 +01:00
Andreas Fischer
48d6724a6f HHVM sets stream meta datum wrapper_type to 'File' instead of 'user-space'. 2014-12-19 00:58:37 +01:00
Robin Appelman
fd85424742 Add getMountPoint to FileInfo 2014-12-17 14:03:50 +01:00
Vincent Petry
5007289422 Sort results to make sure assert work on consistent order 2014-12-15 11:32:32 +01:00
Vincent Petry
4b57892c4e Merge pull request #12778 from owncloud/searchbytags2
Added searchByTags to view, storage and cache
2014-12-12 14:27:19 +01:00
Vincent Petry
15ecb28d50 Make $userId mandatory for searchByTags
$userId is now a mandatory parameter for searchByTags.

Also fixed some places in the code where the argument was missing (Node
API and View)
2014-12-12 11:18:35 +01:00
Vincent Petry
25dde7e93b Added searchByTags to view, storage and cache 2014-12-11 17:38:50 +01:00
Thomas Müller
6143232da6 Merge pull request #12746 from owncloud/skip-longpath-test-again
skip testLongPath()
2014-12-10 17:22:04 +01:00
Vincent Petry
ebba54d490 Fix numeric storage id for cache wrapper 2014-12-10 13:05:31 +01:00
Thomas Müller
d648b548eb skip testLongPath() 2014-12-10 12:20:30 +01:00
Robin Appelman
f4701d7721 Add public api for mount configurations 2014-12-04 16:47:27 +01:00
Morris Jobke
f3213571bb Merge pull request #12616 from owncloud/node-fileinfo
make \OC\Files\Node\Node implement the FileInfo interface
2014-12-04 16:34:30 +01:00
Robin Appelman
672495a1a3 make \OC\Files\Node\Node implement the FileInfo interface 2014-12-04 13:27:08 +01:00
Morris Jobke
2c5e4b3d3f Remove last traces of travis integration 2014-12-04 10:09:13 +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
Robin Appelman
33b64868d7 Add storage and cache wrappers to apply a permissions mask to a storage 2014-11-27 15:25:57 +01:00
Robin Appelman
abb6e89c5d Add storage and cache wrappers to jail a storage to a subfolder 2014-11-27 15:25:53 +01:00
Joas Schilling
2c39aec8cb Replace deprecated constant with new class constant 2014-11-25 16:30:21 +01:00
Joas Schilling
76ebd3a050 Make apps/ extend the \Test\TestCase and fix overwritten methods 2014-11-19 14:52:09 +01:00
Joas Schilling
bb540722cd Use base class to reset the file mapper 2014-11-19 14:52:07 +01:00
Lukas Reschke
8071657cd5 Merge pull request #12234 from owncloud/normalizepath-absolute-tests
Add tests for normalizePath() with absolute paths on windows
2014-11-18 10:24:46 +01:00
Joas Schilling
ccc1001138 Add tests for absolute paths on windows 2014-11-17 16:59:11 +01:00
Joas Schilling
806284f06c Refactor tests to use a dataProvider method 2014-11-17 16:52:45 +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
53318c4bb5 Fix Files\Storage\Home::testRoot() 2014-11-17 10:48:16 +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
Adam Williamson
e0ae87051f storage test: use new file for testTouchCreateFile()
this test would never succeed, because the previous test -
testFOpen() - creates the file 'foo', but testTouchCreateFile()
starts out by asserting it doesn't exist. Change the test to
use a file called 'touch' instead (which does not previously
exist).
2014-11-10 17:49:35 -08:00
Robin Appelman
d26a427f92 Also propagate etag changes when the watcher finds a changed file 2014-11-07 12:56:09 +01:00
Vincent Petry
106b9eb55c Merge pull request #11409 from owncloud/watcher-reuse
Pass the cached data to the filesystem watcher
2014-10-29 16:38:16 +01:00
Thomas Müller
d0ce600eec On Windows platform we have no stable etag generation - yet 2014-10-27 20:48:47 +01:00
Robin Appelman
283c10f010 Generate stable etags for local files 2014-10-24 16:47:58 +02:00
Robin Appelman
16cfca6a5f Better reuse of cache data for getFolderContents 2014-10-24 12:33:54 +02:00
Thomas Müller
770f643e5c Merge pull request #11259 from owncloud/fix-windows-max-depth-test
fixing windows max depth test
2014-10-23 14:34:39 +02:00
Jörn Friedrich Dreyer
27bb968ffa make some storage tests explain what went wrong 2014-10-08 18:49:52 +02:00
Clark Tomlinson
6de8531ace fixing windows max depth test 2014-09-30 16:04:49 -04:00
Clark Tomlinson
55d56f2f0f Resolves cache tests failing if the directory length is longer than 64 2014-09-17 16:24:43 -04:00
Robin Appelman
0878f722db Fix contructor in test 2014-09-10 17:59:32 +02:00
Lukas Reschke
c3d90b96c8 Merge pull request #10922 from owncloud/explicit-scan-transactions
Use bigger transactions when doing explicit file system scans
2014-09-09 23:32:32 +02:00
Jörn Friedrich Dreyer
ed2414fd0d Merge pull request #10886 from owncloud/keep_fileid_on_move_in_objectstore
Keep fileid on move in objectstore, fixes #10848
2014-09-09 10:25:10 +02:00
Jörn Friedrich Dreyer
5943b7ac0d w͢͢͝h͡o͢͡ ̸͢k̵͟n̴͘ǫw̸̛s͘ ̀́w͘͢ḩ̵a҉̡͢t ̧̕h́o̵r͏̵rors̡ ̶͡͠lį̶e͟͟ ̶͝in͢ ͏t̕h̷̡͟e ͟͟d̛a͜r̕͡k̢̨ ͡h̴e͏a̷̢̡rt́͏ ̴̷͠ò̵̶f̸ u̧͘ní̛͜c͢͏o̷͏d̸͢e̡͝ 2014-09-08 15:26:41 +02:00
Robin Appelman
644755df66 Use bigger transactions when doing explicit file system scans 2014-09-08 14:15:41 +02:00
Jörn Friedrich Dreyer
c362c78d76 make objectstore tests check fileid on rename 2014-09-08 12:53:52 +02:00
Robin Appelman
58a1540587 remove unstable test 2014-09-05 11:53:24 +02:00
Robin Appelman
3d92f963f4 Fix unit test 2014-09-05 11:53:23 +02:00
Robin Appelman
65d24c3cd5 Improve unit tests for Cache\Updater 2014-09-05 11:53:23 +02:00
Robin Appelman
850542c5d6 Refactor Cache\Updater to work outside of the users home 2014-09-05 11:53:23 +02:00
Vincent Petry
d261ca616b Merge pull request #10244 from owncloud/utf8-folder-test
add utf8 folder test
2014-09-04 13:42:17 +02:00
Joas Schilling
6a7be8a36a Use a data provider instead of calling the function manually everytime 2014-08-25 15:06:09 +02:00
Joas Schilling
51c9b3c62d Add a test to break the slugifyPath() with folder and file afterwards 2014-08-25 14:38:33 +02:00
Jörn Friedrich Dreyer
76c1095c25 add unit test for #8325 2014-08-14 17:18:46 +02:00
Robin Appelman
174805f5e3 Merge pull request #9762 from owncloud/owner-public
Return the proper owner for home storages
2014-08-12 14:29:17 +02:00
Jörn Friedrich Dreyer
6930ec2bcc add utf8 folder test 2014-08-07 17:12:48 +02:00
Robin Appelman
f1091280de Merge pull request #10184 from owncloud/getbyid-node
Fix Folder::getById
2014-08-07 13:40:17 +02:00
Robin Appelman
1deb6aadd3 return null instead of throwing an exception 2014-08-06 12:06:41 +02:00
Morris Jobke
e717833b07 mark tests as skipped - TODO travis
* swift causes some timeouts and test failures
2014-08-05 18:35:47 +02:00
Robin Appelman
bf8f910a32 Fix Folder::getById 2014-08-05 16:58:10 +02:00
Thomas Müller
1a7d80acd7 only if the environment variable RUN_OBJECTSTORE_TESTS is set the object store unit test will be executed 2014-07-29 21:51:21 +02:00
Robin Appelman
a8532aa2f0 Add test for homestorage getOwner 2014-07-22 16:30:25 +02:00
Jörn Friedrich Dreyer
b5545b81c6 make search case insensitive on postgres and oracle 2014-07-03 19:01:00 +02:00
Jörn Friedrich Dreyer
ab93f1949d update hasUpdated description, overwrtie testStat for objectstore test 2014-06-27 12:14:31 +02:00
Jörn Friedrich Dreyer
28c1a95575 use common storage test 2014-06-23 16:29:01 +02:00
Jörn Friedrich Dreyer
5cae863408 change architecture from inheritance to composition 2014-06-18 12:53:20 +02:00
Jörn Friedrich Dreyer
5722e31d1a add autocreate config option for containers, implement autocreate and delete of containers, use generated container names for tests 2014-06-18 12:53:20 +02:00
Jörn Friedrich Dreyer
7493ff0624 fix unit test by always initializing the root of the storage in the constructor 2014-06-18 12:53:20 +02:00
Jörn Friedrich Dreyer
c18836c8ae add initial swift test with trystack 2014-06-18 12:53:20 +02:00
Vincent Petry
b595c982d0 Merge pull request #8968 from owncloud/scanner-parent-repair
Repair broken parent link in the scanner
2014-06-12 17:40:44 +02:00
Vincent Petry
67413e3ada Use assertNotSame when checking etags
Sometimes etags contain a "e" character which makes PHP believe it's a
number and make the tests fail
2014-06-11 17:28:18 +02:00
Robin Appelman
21cfd1014a Repair broken parent link in the scanner 2014-06-10 15:26:18 +02:00
Vincent Petry
6e2358c3a6 Added hacky fix for long path cleanup routine 2014-06-06 10:41:49 +02:00
Thomas Müller
ad4ec414c9 use system function to recursive remove the directory used by temporary storage 2014-06-06 09:29:31 +02:00
Thomas Müller
e1beb8c6c3 Merge pull request #8889 from owncloud/mtime-reuse
Don't update the mtime if the storage mtime hasn't changed
2014-06-05 13:18:18 +02:00
Robin Appelman
9dab6ec2ec Fix uit tests 2014-06-05 11:31:55 +02:00
Thomas Müller
ff3ded6cb2 Merge pull request #8852 from owncloud/kill-permissions-master
Kill permissions table
2014-06-05 10:05:05 +02:00
Thomas Müller
da3974bcb2 - drop permissions table and related code
- the file/folder's permission is now stored in the file cache
- BackGroundWatcher has been removed - this has meanwhile be replaced by occ files:scan which can be executed in a cron jobs
- increase version to trigger database migration
2014-06-05 08:22:01 +02:00
Vincent Petry
b5f0a17918 Merge pull request #8822 from owncloud/cache-change-propagator
[WIP] Improved propagation of cache changes
2014-06-04 13:03:14 +02:00
Robin Appelman
3bcdad62fb Fix unit tests 2014-06-04 10:01:50 +02:00
ringmaster
0e85618c42 Can't use assertInstanceOf on wrapped storage; use assertTrue(instanceOfStorage() instead. 2014-06-04 07:55:46 +02:00
Bjoern Schiessle
2b30fb4862 fix unit test after adding the additional parameter to addStorageWrapper() 2014-06-04 07:55:46 +02:00
Robin Appelman
f297bf14f9 Fix unit tests 2014-06-03 11:55:18 +02:00
Robin Appelman
e002ff6065 propagate changes in the scanner 2014-06-02 15:24:08 +02:00
Robin Appelman
a31f089266 Add a change propagator class to handle propagating etag and mtime changes 2014-06-02 14:39:12 +02:00
Robin Appelman
8c5521fdfc Add $storage->instanceOfStorage to handle instanceof for storage wrappers 2014-05-29 13:45:50 +02:00
icewind1991
c0f02be50a Merge pull request #3908 from owncloud/storage-folder-copy-rename
Recursive copy and remove for local storage backends
2014-05-29 13:29:24 +02:00
Robin Appelman
1302602173 fix illegal usage of unlink in test case 2014-05-28 18:16:23 +02:00
Robin Appelman
03ba497a8c add recursive copy to local storage backend 2014-05-28 18:16:23 +02:00
Robin Appelman
38c1da0976 fix recursive rename for local storage backend 2014-05-28 18:16:23 +02:00
Robin Appelman
c99e254178 aditional test cases for copy and rename 2014-05-28 18:16:23 +02:00
Thomas Müller
a2e4bc8d33 # This is a combination of 2 commits.
# The first commit's message is:

adding tests for long paths
increment path field in database up to 4000 (maximum for Oracle - otherwise we could use php's 4096)
increment version to trigger database migration
adding unit test for too long path

# This is the 2nd commit message:

fix too long path
2014-05-28 15:30:44 +02:00
Morris Jobke
dc36d30953 Remove all occurences of @brief and @returns from PHPDoc
* test case added to avoid adding them later
2014-05-19 17:50:53 +02:00
Lukas Reschke
b0381cfe12 Add tests for other types that PHP might cast
Addition to https://github.com/owncloud/core/pull/8572
2014-05-13 22:01:11 +02:00
Vincent Petry
bab8c1f8e5 Fixed getAbsolutePath case when path is "0"
Make sure to correctly check for string emptiness when the passed path
is "0".
2014-05-13 17:38:46 +02:00
Joas Schilling
ced2a4fcf2 Remove unneccessary statement from test 2014-04-29 10:42:49 +02:00
Joas Schilling
39bf700790 Update tests to test for create and update aswell 2014-04-29 10:34:28 +02:00
Thomas Müller
a2efdb8722 Merge pull request #7970 from owncloud/webdav-upload-hash
Fix uploading files containing a # in the path for webdav
2014-04-03 16:09:44 +02:00
Vincent Petry
d6ce45fe61 Correctly read the full stream in file_get_contents
When using user-defined stream wrappers, PHP will
return a maximum of 8192 bytes even if more was
requested.

This fix uses stream_get_contents to make sure the full stream is read
and not only the first 8 KB.

Added unit test with a bigger test file to cover this case.
2014-04-01 10:07:16 +02:00
Robin Appelman
76c63a5760 Fix uploading files containing a # in the path for webdav 2014-03-31 17:00:32 +02:00
Thomas Müller
70db348475 Merge pull request #7824 from owncloud/hash-parameter-order
Fix parameter order for Storage\Local::hash
2014-03-28 13:06:07 +01:00
Vincent Petry
040f430f0c Merge pull request #7829 from owncloud/cachefolderlocation
Cache folder is now configurable
2014-03-28 12:08:38 +01:00
Thomas Müller
1ae10b9da3 Merge pull request #7420 from owncloud/cachehooks-first
Manually triger the filecache update hooks before any other hook
2014-03-25 22:41:09 +01:00
Thomas Müller
bbc2e37259 Merge pull request #7477 from owncloud/foldersize-reuse
Allow re-using already known fileinfo when calculating folder sizes
2014-03-25 22:33:24 +01:00
Vincent Petry
1e39719926 Added unit tests for external cache folder 2014-03-24 14:32:04 +01:00
Robin Appelman
fffe330bbc Fix parameter order for Storage\Local::hash 2014-03-20 15:32:12 +01:00
Vincent Petry
66bc0f0848 Still return quota value when free space is unknown
Fixed the quota storage wrapper to correctly return the quota value when
the free space is not known (which usually happens when the disk_free_space
function is disabled)
2014-03-19 19:07:11 +01:00
Robin Appelman
eabeedb306 Merge branch 'master' into cachehooks-first 2014-03-13 15:22:00 +01:00
Robin Appelman
d55c7223a9 Merge branch 'master' into foldersize-reuse
Conflicts:
lib/private/files/cache/homecache.php
2014-03-11 13:04:20 +01:00
Vincent Petry
48d63a6278 Return unencrypted_size of folder when queried
This fixes the "used space" to be based on the unencrypted size, not
encrypted size, to be consistent with how quota/space is handled when
encryption is enabled
2014-03-07 14:59:09 +01:00
Robin Appelman
bb8a7a2230 Remove assert since the root size of the home storage is no longer calculated 2014-03-03 16:48:06 +01:00
Jörn Friedrich Dreyer
2ba6cd4e2b initialize etags of temporary storage 2014-02-27 12:44:07 +01:00
Jörn Friedrich Dreyer
131c12ad8d use assertInternalType for typechecking 2014-02-27 09:51:26 +01:00
Jörn Friedrich Dreyer
39f2f564a9 use assertSame and assertNotSame for etag checks 2014-02-27 09:39:34 +01:00
Robin Appelman
bc49c6be04 Manually triger the filecache update hooks before any other hook 2014-02-26 14:29:13 +01:00
Thomas Müller
ec45a3c0e2 Merge pull request #6962 from owncloud/quota-space-root
Allow passing a root folder to get the used space from in the quota wrapper
2014-02-20 16:47:59 +01:00
Vincent Petry
b2b35cd335 Fixed ext storage webdav path encoding
- Some WebDAV servers like lighttpd need paths in URLs to be properly
encoded
- Added error log output when curl connection failed
- Added check for 'resourcetype' in case the WebDAV server doesn't
  support/return it
- Fixed touch() to return false if the server doesn't implement
  PROPPATCH
- Added optional delay in WebDAV unit tests to use when testing against
  lighttpd's WebDAV
2014-02-19 18:34:08 +01:00
Morris Jobke
bcad6e641a Merge pull request #7274 from owncloud/scrutinizer-patch-1
Scrutinizer Auto-Fixes
2014-02-19 11:51:04 +01:00
Robin Appelman
eea1abae20 add unit tests for watcher policies 2014-02-19 09:52:51 +01:00
Scrutinizer Auto-Fixer
adaee6a5a1 Scrutinizer Auto-Fixes
This patch was automatically generated as part of the following inspection:
https://scrutinizer-ci.com/g/owncloud/core/inspections/cdfecc4e-a37e-4233-8025-f0d7252a8720

Enabled analysis tools:
 - PHP Analyzer
 - JSHint
 - PHP Copy/Paste Detector
 - PHP PDepend
2014-02-19 09:31:54 +01:00
Robin Appelman
2166683e3b Allow setting the frequency of which the file watcher checks for updates 2014-02-18 16:34:25 +01:00
Robin Appelman
3afdcd85e7 Add unit test for quote wrapper size root 2014-02-04 16:05:12 +01:00
Vincent Petry
1af7dab535 Fixed quota wrapper to not wrap failed fopen streams
When calling fopen() on some storage types, these return false instead
of throwing an exception.

This fix makes sure that in case the stream wasn't opened (for example
when a file doesn't exist any more) the stream isn't wrapped.

Also added 'rb' as another case that doesn't need to be wrapped.

Fixes #6832
2014-01-19 18:51:36 +01:00
Vincent Petry
23e6578601 Fix array access syntax for older PHP
There was a syntax error when running tests in PHP 5.3.10.
2014-01-17 12:31:22 +01:00
Vincent Petry
34559ef114 Merge pull request #6768 from owncloud/scanner-use-storage-mtime
Use storage_mtime when determining if we can reuse cached data while scanning
2014-01-15 01:31:33 -08:00
Robin Appelman
16b898ddb8 update another test 2014-01-14 20:19:05 +01:00
Robin Appelman
7e4c80fd60 use different value for mtime and storage_mtime in test 2014-01-14 15:13:21 +01:00
Robin Appelman
4113042c8f remove duplicate test class 2014-01-14 15:11:41 +01:00
Robin Appelman
203d5d01ca Use storage_mtime when determining if we can reuse cached data while scanning 2014-01-14 13:54:07 +01:00
Vincent Petry
4faba49f0a Fix calculated folder size to use unencrypted size
The encrypted size was used when calculating folder sizes.
This fix now also sums up the unencrypted size and shows that one when
available.
2014-01-09 17:47:50 +01:00
Vincent Petry
f642ad3961 Prevent deleting storage root
Storage mount points are not deletable, so make sure that the unlink
operation and its hooks aren't run in such cases.

Note that some storages might recursively delete their contents when
calling unlink on their root. This fix prevents that as well.
2014-01-08 13:17:36 +01:00
Vincent Petry
5be4af9f51 Now also preventing to override "files" dir size with -1
Fixes #6526
2014-01-07 22:34:01 +01:00
Robin Appelman
46b72cbff0 remove unneeded ; in comment 2013-12-12 15:14:44 +01:00
Robin Appelman
30e0b474f8 Add test for having utf8 filenames in the cache 2013-12-12 13:43:55 +01:00
Robin Appelman
e888bdda30 get rid of failing test that don't cause additional downloads 2013-12-06 18:26:38 +01:00
Robin Appelman
cf9b7e343a extend test case for etag preservation 2013-12-06 13:00:58 +01:00