Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
902d1255
Unverified
Commit
902d1255
authored
5 years ago
by
Julius Härtl
Browse files
Options
Downloads
Patches
Plain Diff
Do not include mountpoints when calculating quota usage on WebDAV
Signed-off-by:
Julius Härtl
<
jus@bitgrid.net
>
parent
797fa188
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/dav/lib/Connector/Sabre/Directory.php
+2
-1
2 additions, 1 deletion
apps/dav/lib/Connector/Sabre/Directory.php
apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+18
-10
18 additions, 10 deletions
apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
with
20 additions
and
11 deletions
apps/dav/lib/Connector/Sabre/Directory.php
+
2
−
1
View file @
902d1255
...
...
@@ -326,7 +326,8 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
return
$this
->
quotaInfo
;
}
try
{
$storageInfo
=
\OC_Helper
::
getStorageInfo
(
$this
->
info
->
getPath
(),
$this
->
info
);
$info
=
$this
->
fileView
->
getFileInfo
(
$this
->
path
,
false
);
$storageInfo
=
\OC_Helper
::
getStorageInfo
(
$this
->
info
->
getPath
(),
$info
);
if
(
$storageInfo
[
'quota'
]
===
\OCP\Files\FileInfo
::
SPACE_UNLIMITED
)
{
$free
=
\OCP\Files\FileInfo
::
SPACE_UNLIMITED
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+
18
−
10
View file @
902d1255
...
...
@@ -98,7 +98,7 @@ class DirectoryTest extends \Test\TestCase {
return
new
Directory
(
$this
->
view
,
$this
->
info
);
}
public
function
testDeleteRootFolderFails
()
{
$this
->
expectException
(
\Sabre\DAV\Exception\Forbidden
::
class
);
...
...
@@ -111,7 +111,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
delete
();
}
public
function
testDeleteForbidden
()
{
$this
->
expectException
(
\OCA\DAV\Connector\Sabre\Exception\Forbidden
::
class
);
...
...
@@ -130,7 +130,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
delete
();
}
public
function
testDeleteFolderWhenAllowed
()
{
// deletion allowed
$this
->
info
->
expects
(
$this
->
once
())
...
...
@@ -147,7 +147,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
delete
();
}
public
function
testDeleteFolderFailsWhenNotAllowed
()
{
$this
->
expectException
(
\Sabre\DAV\Exception\Forbidden
::
class
);
...
...
@@ -159,7 +159,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
delete
();
}
public
function
testDeleteFolderThrowsWhenDeletionFailed
()
{
$this
->
expectException
(
\Sabre\DAV\Exception\Forbidden
::
class
);
...
...
@@ -217,7 +217,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
getChildren
();
}
public
function
testGetChildrenNoPermission
()
{
$this
->
expectException
(
\Sabre\DAV\Exception\Forbidden
::
class
);
...
...
@@ -230,7 +230,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
getChildren
();
}
public
function
testGetChildNoPermission
()
{
$this
->
expectException
(
\Sabre\DAV\Exception\NotFound
::
class
);
...
...
@@ -242,7 +242,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
getChild
(
'test'
);
}
public
function
testGetChildThrowStorageNotAvailableException
()
{
$this
->
expectException
(
\Sabre\DAV\Exception\ServiceUnavailable
::
class
);
...
...
@@ -254,7 +254,7 @@ class DirectoryTest extends \Test\TestCase {
$dir
->
getChild
(
'.'
);
}
public
function
testGetChildThrowInvalidPath
()
{
$this
->
expectException
(
\OCA\DAV\Connector\Sabre\Exception\InvalidPath
::
class
);
...
...
@@ -295,6 +295,10 @@ class DirectoryTest extends \Test\TestCase {
->
method
(
'getStorage'
)
->
willReturn
(
$storage
);
$this
->
view
->
expects
(
$this
->
once
())
->
method
(
'getFileInfo'
)
->
willReturn
(
$this
->
info
);
$dir
=
new
Directory
(
$this
->
view
,
$this
->
info
);
$this
->
assertEquals
([
200
,
-
3
],
$dir
->
getQuotaInfo
());
//200 used, unlimited
}
...
...
@@ -327,6 +331,10 @@ class DirectoryTest extends \Test\TestCase {
->
method
(
'getStorage'
)
->
willReturn
(
$storage
);
$this
->
view
->
expects
(
$this
->
once
())
->
method
(
'getFileInfo'
)
->
willReturn
(
$this
->
info
);
$dir
=
new
Directory
(
$this
->
view
,
$this
->
info
);
$this
->
assertEquals
([
200
,
800
],
$dir
->
getQuotaInfo
());
//200 used, 800 free
}
...
...
@@ -404,7 +412,7 @@ class DirectoryTest extends \Test\TestCase {
$this
->
assertTrue
(
$targetNode
->
moveInto
(
basename
(
$destination
),
$source
,
$sourceNode
));
}
public
function
testFailingMove
()
{
$this
->
expectException
(
\Sabre\DAV\Exception\Forbidden
::
class
);
$this
->
expectExceptionMessage
(
'Could not copy directory b, target exists'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment