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
9fbdd107
Commit
9fbdd107
authored
10 years ago
by
Vincent Petry
Browse files
Options
Downloads
Patches
Plain Diff
Fix webdav mkdir for remote shares
parent
ff571577
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_sharing/lib/external/cache.php
+3
-0
3 additions, 0 deletions
apps/files_sharing/lib/external/cache.php
apps/files_sharing/tests/external/cache.php
+112
-0
112 additions, 0 deletions
apps/files_sharing/tests/external/cache.php
with
115 additions
and
0 deletions
apps/files_sharing/lib/external/cache.php
+
3
−
0
View file @
9fbdd107
...
@@ -28,6 +28,9 @@ class Cache extends \OC\Files\Cache\Cache {
...
@@ -28,6 +28,9 @@ class Cache extends \OC\Files\Cache\Cache {
public
function
get
(
$file
)
{
public
function
get
(
$file
)
{
$result
=
parent
::
get
(
$file
);
$result
=
parent
::
get
(
$file
);
if
(
!
$result
)
{
return
false
;
}
$result
[
'displayname_owner'
]
=
$this
->
remoteUser
.
'@'
.
$this
->
remote
;
$result
[
'displayname_owner'
]
=
$this
->
remoteUser
.
'@'
.
$this
->
remote
;
if
(
!
$file
||
$file
===
''
)
{
if
(
!
$file
||
$file
===
''
)
{
$result
[
'is_share_mount_point'
]
=
true
;
$result
[
'is_share_mount_point'
]
=
true
;
...
...
This diff is collapsed.
Click to expand it.
apps/files_sharing/tests/external/cache.php
0 → 100644
+
112
−
0
View file @
9fbdd107
<?php
use
OCA\Files_sharing
\Tests\TestCase
;
/**
* ownCloud
*
* @author Vincent Petry
* @copyright 2015 Vincent Petry <pvince81@owncloud.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class
Test_Files_Sharing_External_Cache
extends
TestCase
{
/**
* @var \OC\Files\Storage\Storage
**/
private
$storage
;
/**
* @var \OCA\Files_Sharing\External\Cache
*/
private
$cache
;
/**
* @var string
*/
private
$remoteUser
;
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
remoteUser
=
$this
->
getUniqueID
(
'remoteuser'
);
$this
->
storage
=
$this
->
getMockBuilder
(
'\OCA\Files_Sharing\External\Storage'
)
->
disableOriginalConstructor
()
->
getMock
();
$this
->
storage
->
expects
(
$this
->
any
())
->
method
(
'getId'
)
->
will
(
$this
->
returnValue
(
'dummystorage::'
));
$this
->
cache
=
new
\OCA\Files_Sharing\External\Cache
(
$this
->
storage
,
'http://example.com/owncloud'
,
$this
->
remoteUser
);
$this
->
cache
->
put
(
'test.txt'
,
array
(
'mimetype'
=>
'text/plain'
,
'size'
=>
5
,
'mtime'
=>
123
,
)
);
}
protected
function
tearDown
()
{
$this
->
cache
->
clear
();
parent
::
tearDown
();
}
public
function
testGetInjectsOwnerDisplayName
()
{
$info
=
$this
->
cache
->
get
(
'test.txt'
);
$this
->
assertEquals
(
$this
->
remoteUser
.
'@example.com/owncloud'
,
$info
[
'displayname_owner'
]
);
}
public
function
testGetReturnsFalseIfNotFound
()
{
$info
=
$this
->
cache
->
get
(
'unexisting-entry.txt'
);
$this
->
assertFalse
(
$info
);
}
public
function
testGetFolderPopulatesOwner
()
{
$dirId
=
$this
->
cache
->
put
(
'subdir'
,
array
(
'mimetype'
=>
'httpd/unix-directory'
,
'size'
=>
5
,
'mtime'
=>
123
,
)
);
$this
->
cache
->
put
(
'subdir/contents.txt'
,
array
(
'mimetype'
=>
'text/plain'
,
'size'
=>
5
,
'mtime'
=>
123
,
)
);
$results
=
$this
->
cache
->
getFolderContentsById
(
$dirId
);
$this
->
assertEquals
(
1
,
count
(
$results
));
$this
->
assertEquals
(
$this
->
remoteUser
.
'@example.com/owncloud'
,
$results
[
0
][
'displayname_owner'
]
);
}
}
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