summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-10 21:18:19 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-10 21:18:19 +0100
commit8e51634e6d988e87d597be669d93d1b8f7b607d6 (patch)
tree9b5c0ede6d4dccdc8e6ba2614f8977edbc9e2d04
parent3cec5f7f6cc9b107beecbd289967065b022167cb (diff)
parentca2a24d2862064aabefd604d094b3c96547d6f20 (diff)
downloadnextcloud-server-8e51634e6d988e87d597be669d93d1b8f7b607d6.tar.gz
nextcloud-server-8e51634e6d988e87d597be669d93d1b8f7b607d6.zip
Merge pull request #23056 from owncloud/fix_23044
Add mimetype to OCS Share API output
-rw-r--r--apps/files_sharing/api/share20ocs.php1
-rw-r--r--apps/files_sharing/tests/api/share20ocstest.php22
-rw-r--r--build/integration/features/sharing-v1.feature7
3 files changed, 26 insertions, 4 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php
index 0c9e5473d9c..f31aa55e34d 100644
--- a/apps/files_sharing/api/share20ocs.php
+++ b/apps/files_sharing/api/share20ocs.php
@@ -115,6 +115,7 @@ class Share20OCS {
} else {
$result['item_type'] = 'file';
}
+ $result['mimetype'] = $node->getMimeType();
$result['storage_id'] = $node->getStorage()->getId();
$result['storage'] = $node->getStorage()->getCache()->getNumericStorageId();
$result['item_source'] = $node->getId();
diff --git a/apps/files_sharing/tests/api/share20ocstest.php b/apps/files_sharing/tests/api/share20ocstest.php
index 81db3b96333..a2c70d7673c 100644
--- a/apps/files_sharing/tests/api/share20ocstest.php
+++ b/apps/files_sharing/tests/api/share20ocstest.php
@@ -203,12 +203,14 @@ class Share20OCSTest extends \Test\TestCase {
$file->method('getPath')->willReturn('file');
$file->method('getStorage')->willReturn($storage);
$file->method('getParent')->willReturn($parentFolder);
+ $file->method('getMimeType')->willReturn('myMimeType');
$folder = $this->getMock('OCP\Files\Folder');
$folder->method('getId')->willReturn(2);
$folder->method('getPath')->willReturn('folder');
$folder->method('getStorage')->willReturn($storage);
$folder->method('getParent')->willReturn($parentFolder);
+ $folder->method('getMimeType')->willReturn('myFolderMimeType');
// File shared with user
$share = $this->createShare(
@@ -247,7 +249,8 @@ class Share20OCSTest extends \Test\TestCase {
'storage' => 101,
'mail_send' => 0,
'uid_file_owner' => 'ownerId',
- 'displayname_file_owner' => 'ownerDisplay'
+ 'displayname_file_owner' => 'ownerDisplay',
+ 'mimetype' => 'myMimeType',
];
$data[] = [$share, $expected];
@@ -288,7 +291,8 @@ class Share20OCSTest extends \Test\TestCase {
'storage' => 101,
'mail_send' => 0,
'uid_file_owner' => 'ownerId',
- 'displayname_file_owner' => 'ownerDisplay'
+ 'displayname_file_owner' => 'ownerDisplay',
+ 'mimetype' => 'myFolderMimeType',
];
$data[] = [$share, $expected];
@@ -333,7 +337,8 @@ class Share20OCSTest extends \Test\TestCase {
'mail_send' => 0,
'url' => 'url',
'uid_file_owner' => 'ownerId',
- 'displayname_file_owner' => 'ownerDisplay'
+ 'displayname_file_owner' => 'ownerDisplay',
+ 'mimetype' => 'myFolderMimeType',
];
$data[] = [$share, $expected];
@@ -1514,6 +1519,9 @@ class Share20OCSTest extends \Test\TestCase {
$folder = $this->getMock('\OCP\Files\Folder');
$parent = $this->getMock('\OCP\Files\Folder');
+ $file->method('getMimeType')->willReturn('myMimeType');
+ $folder->method('getMimeType')->willReturn('myFolderMimeType');
+
$file->method('getPath')->willReturn('file');
$folder->method('getPath')->willReturn('folder');
@@ -1578,6 +1586,7 @@ class Share20OCSTest extends \Test\TestCase {
'share_with' => 'recipient',
'share_with_displayname' => 'recipient',
'mail_send' => 0,
+ 'mimetype' => 'myMimeType',
], $share, [], false
];
@@ -1606,6 +1615,7 @@ class Share20OCSTest extends \Test\TestCase {
'share_with' => 'recipient',
'share_with_displayname' => 'recipientDN',
'mail_send' => 0,
+ 'mimetype' => 'myMimeType',
], $share, [
['owner', $owner],
['initiator', $initiator],
@@ -1649,6 +1659,7 @@ class Share20OCSTest extends \Test\TestCase {
'share_with' => 'recipient',
'share_with_displayname' => 'recipient',
'mail_send' => 0,
+ 'mimetype' => 'myMimeType',
], $share, [], false
];
@@ -1687,6 +1698,7 @@ class Share20OCSTest extends \Test\TestCase {
'share_with' => 'recipient',
'share_with_displayname' => 'recipient',
'mail_send' => 0,
+ 'mimetype' => 'myMimeType',
], $share, [], false
];
@@ -1727,7 +1739,8 @@ class Share20OCSTest extends \Test\TestCase {
'share_with' => 'mypassword',
'share_with_displayname' => 'mypassword',
'mail_send' => 0,
- 'url' => 'myLink'
+ 'url' => 'myLink',
+ 'mimetype' => 'myMimeType',
], $share, [], false
];
@@ -1766,6 +1779,7 @@ class Share20OCSTest extends \Test\TestCase {
'share_with' => 'user@server.com',
'share_with_displayname' => 'user@server.com',
'mail_send' => 0,
+ 'mimetype' => 'myFolderMimeType',
], $share, [], false
];
diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature
index 00e760ce167..ba535e83aab 100644
--- a/build/integration/features/sharing-v1.feature
+++ b/build/integration/features/sharing-v1.feature
@@ -65,6 +65,7 @@ Feature: sharing
| expiration | +3 days |
| url | AN_URL |
| token | A_TOKEN |
+ | mimetype | httpd/unix-directory |
Scenario: Creating a new public share with password and adding an expiration date
Given user "user0" exists
@@ -108,6 +109,7 @@ Feature: sharing
| file_parent | A_NUMBER |
| displayname_owner | user0 |
| url | AN_URL |
+ | mimetype | httpd/unix-directory |
Scenario: Creating a new public share, updating its password and getting its info
Given user "user0" exists
@@ -137,6 +139,7 @@ Feature: sharing
| file_parent | A_NUMBER |
| displayname_owner | user0 |
| url | AN_URL |
+ | mimetype | httpd/unix-directory |
Scenario: Creating a new public share, updating its permissions and getting its info
Given user "user0" exists
@@ -166,6 +169,7 @@ Feature: sharing
| file_parent | A_NUMBER |
| displayname_owner | user0 |
| url | AN_URL |
+ | mimetype | httpd/unix-directory |
Scenario: Creating a new public share, updating publicUpload option and getting its info
Given user "user0" exists
@@ -195,6 +199,7 @@ Feature: sharing
| file_parent | A_NUMBER |
| displayname_owner | user0 |
| url | AN_URL |
+ | mimetype | httpd/unix-directory |
Scenario: getting all shares of a user using that user
Given user "user0" exists
@@ -272,6 +277,7 @@ Feature: sharing
| file_parent | A_NUMBER |
| share_with_displayname | user1 |
| displayname_owner | user0 |
+ | mimetype | text/plain |
Scenario: keep group permissions in sync
Given As an "admin"
@@ -302,6 +308,7 @@ Feature: sharing
| storage_id | home::user0 |
| file_parent | A_NUMBER |
| displayname_owner | user0 |
+ | mimetype | text/plain |
Scenario: Sharee can see the share
Given user "user0" exists