check for encryption state on propfind
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
f347e2e4a6
commit
fc456bec39
|
@ -74,6 +74,7 @@
|
||||||
Client.PROPERTY_PERMISSIONS = '{' + Client.NS_OWNCLOUD + '}permissions';
|
Client.PROPERTY_PERMISSIONS = '{' + Client.NS_OWNCLOUD + '}permissions';
|
||||||
Client.PROPERTY_SIZE = '{' + Client.NS_OWNCLOUD + '}size';
|
Client.PROPERTY_SIZE = '{' + Client.NS_OWNCLOUD + '}size';
|
||||||
Client.PROPERTY_GETCONTENTLENGTH = '{' + Client.NS_DAV + '}getcontentlength';
|
Client.PROPERTY_GETCONTENTLENGTH = '{' + Client.NS_DAV + '}getcontentlength';
|
||||||
|
Client.PROPERTY_ISENCRYPTED = '{' + Client.NS_DAV + '}is-encrypted';
|
||||||
|
|
||||||
Client.PROTOCOL_HTTP = 'http';
|
Client.PROTOCOL_HTTP = 'http';
|
||||||
Client.PROTOCOL_HTTPS = 'https';
|
Client.PROTOCOL_HTTPS = 'https';
|
||||||
|
@ -120,6 +121,10 @@
|
||||||
* Mount type
|
* Mount type
|
||||||
*/
|
*/
|
||||||
[Client.NS_NEXTCLOUD, 'mount-type'],
|
[Client.NS_NEXTCLOUD, 'mount-type'],
|
||||||
|
/**
|
||||||
|
* Encryption state
|
||||||
|
*/
|
||||||
|
[Client.NS_NEXTCLOUD, 'is-encrypted'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -305,6 +310,13 @@
|
||||||
data.hasPreview = true;
|
data.hasPreview = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isEncryptedProp = props['{' + Client.NS_NEXTCLOUD + '}is-encrypted'];
|
||||||
|
if (!_.isUndefined(isEncryptedProp)) {
|
||||||
|
data.isEncrypted = isEncryptedProp === '1';
|
||||||
|
} else {
|
||||||
|
data.isEncrypted = false;
|
||||||
|
}
|
||||||
|
|
||||||
var contentType = props[Client.PROPERTY_GETCONTENTTYPE];
|
var contentType = props[Client.PROPERTY_GETCONTENTTYPE];
|
||||||
if (!_.isUndefined(contentType)) {
|
if (!_.isUndefined(contentType)) {
|
||||||
data.mimetype = contentType;
|
data.mimetype = contentType;
|
||||||
|
|
|
@ -224,6 +224,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(props).toContain('{http://owncloud.org/ns}fileid');
|
expect(props).toContain('{http://owncloud.org/ns}fileid');
|
||||||
expect(props).toContain('{http://owncloud.org/ns}size');
|
expect(props).toContain('{http://owncloud.org/ns}size');
|
||||||
expect(props).toContain('{http://owncloud.org/ns}permissions');
|
expect(props).toContain('{http://owncloud.org/ns}permissions');
|
||||||
|
expect(props).toContain('{http://nextcloud.org/ns}is-encrypted');
|
||||||
});
|
});
|
||||||
it('sends PROPFIND to base url when empty path given', function() {
|
it('sends PROPFIND to base url when empty path given', function() {
|
||||||
client.getFolderContents('');
|
client.getFolderContents('');
|
||||||
|
@ -262,6 +263,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(info.mtime).toEqual(1436535485000);
|
expect(info.mtime).toEqual(1436535485000);
|
||||||
expect(info.mimetype).toEqual('text/plain');
|
expect(info.mimetype).toEqual('text/plain');
|
||||||
expect(info.etag).toEqual('559fcabd79a38');
|
expect(info.etag).toEqual('559fcabd79a38');
|
||||||
|
expect(info.isEncrypted).toEqual(false);
|
||||||
|
|
||||||
// sub entry
|
// sub entry
|
||||||
info = response[1];
|
info = response[1];
|
||||||
|
@ -274,6 +276,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(info.mtime).toEqual(1436536800000);
|
expect(info.mtime).toEqual(1436536800000);
|
||||||
expect(info.mimetype).toEqual('httpd/unix-directory');
|
expect(info.mimetype).toEqual('httpd/unix-directory');
|
||||||
expect(info.etag).toEqual('66cfcabd79abb');
|
expect(info.etag).toEqual('66cfcabd79abb');
|
||||||
|
expect(info.isEncrypted).toEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('returns parent node in result if specified', function() {
|
it('returns parent node in result if specified', function() {
|
||||||
|
@ -303,6 +306,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(info.mtime).toEqual(1436522405000);
|
expect(info.mtime).toEqual(1436522405000);
|
||||||
expect(info.mimetype).toEqual('httpd/unix-directory');
|
expect(info.mimetype).toEqual('httpd/unix-directory');
|
||||||
expect(info.etag).toEqual('56cfcabd79abb');
|
expect(info.etag).toEqual('56cfcabd79abb');
|
||||||
|
expect(info.isEncrypted).toEqual(false);
|
||||||
|
|
||||||
// the two other entries follow
|
// the two other entries follow
|
||||||
expect(response[1].id).toEqual(51);
|
expect(response[1].id).toEqual(51);
|
||||||
|
@ -422,6 +426,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(props).toContain('{http://owncloud.org/ns}fileid');
|
expect(props).toContain('{http://owncloud.org/ns}fileid');
|
||||||
expect(props).toContain('{http://owncloud.org/ns}size');
|
expect(props).toContain('{http://owncloud.org/ns}size');
|
||||||
expect(props).toContain('{http://owncloud.org/ns}permissions');
|
expect(props).toContain('{http://owncloud.org/ns}permissions');
|
||||||
|
expect(props).toContain('{http://nextcloud.org/ns}is-encrypted');
|
||||||
});
|
});
|
||||||
it('parses the result list into a FileInfo array', function() {
|
it('parses the result list into a FileInfo array', function() {
|
||||||
var promise = client.getFilteredFiles({
|
var promise = client.getFilteredFiles({
|
||||||
|
@ -473,7 +478,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
describe('file info', function() {
|
describe('file info', function() {
|
||||||
var responseXml = dav.Client.prototype.parseMultiStatus(
|
var responseXml = dav.Client.prototype.parseMultiStatus(
|
||||||
'<?xml version="1.0" encoding="utf-8"?>' +
|
'<?xml version="1.0" encoding="utf-8"?>' +
|
||||||
'<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">' +
|
'<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">' +
|
||||||
makeResponseBlock(
|
makeResponseBlock(
|
||||||
'/owncloud/remote.php/webdav/path/to%20space/%E6%96%87%E4%BB%B6%E5%A4%B9/',
|
'/owncloud/remote.php/webdav/path/to%20space/%E6%96%87%E4%BB%B6%E5%A4%B9/',
|
||||||
{
|
{
|
||||||
|
@ -483,7 +488,8 @@ describe('OC.Files.Client tests', function() {
|
||||||
'oc:id': '00000011oc2d13a6a068',
|
'oc:id': '00000011oc2d13a6a068',
|
||||||
'oc:fileid': '11',
|
'oc:fileid': '11',
|
||||||
'oc:permissions': 'GRDNVCK',
|
'oc:permissions': 'GRDNVCK',
|
||||||
'oc:size': '120'
|
'oc:size': '120',
|
||||||
|
'nc:is-encrypted': '1'
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
'd:getcontenttype',
|
'd:getcontenttype',
|
||||||
|
@ -510,6 +516,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(props).toContain('{http://owncloud.org/ns}fileid');
|
expect(props).toContain('{http://owncloud.org/ns}fileid');
|
||||||
expect(props).toContain('{http://owncloud.org/ns}size');
|
expect(props).toContain('{http://owncloud.org/ns}size');
|
||||||
expect(props).toContain('{http://owncloud.org/ns}permissions');
|
expect(props).toContain('{http://owncloud.org/ns}permissions');
|
||||||
|
expect(props).toContain('{http://nextcloud.org/ns}is-encrypted');
|
||||||
});
|
});
|
||||||
it('parses the result into a FileInfo', function() {
|
it('parses the result into a FileInfo', function() {
|
||||||
var promise = client.getFileInfo('path/to space/文件夹');
|
var promise = client.getFileInfo('path/to space/文件夹');
|
||||||
|
@ -535,6 +542,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(info.mtime).toEqual(1436522405000);
|
expect(info.mtime).toEqual(1436522405000);
|
||||||
expect(info.mimetype).toEqual('httpd/unix-directory');
|
expect(info.mimetype).toEqual('httpd/unix-directory');
|
||||||
expect(info.etag).toEqual('56cfcabd79abb');
|
expect(info.etag).toEqual('56cfcabd79abb');
|
||||||
|
expect(info.isEncrypted).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('properly parses entry inside root', function() {
|
it('properly parses entry inside root', function() {
|
||||||
|
@ -583,6 +591,7 @@ describe('OC.Files.Client tests', function() {
|
||||||
expect(info.mtime).toEqual(1436522405000);
|
expect(info.mtime).toEqual(1436522405000);
|
||||||
expect(info.mimetype).toEqual('httpd/unix-directory');
|
expect(info.mimetype).toEqual('httpd/unix-directory');
|
||||||
expect(info.etag).toEqual('56cfcabd79abb');
|
expect(info.etag).toEqual('56cfcabd79abb');
|
||||||
|
expect(info.isEncrypted).toEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('rejects promise when an error occurred', function() {
|
it('rejects promise when an error occurred', function() {
|
||||||
|
|
Loading…
Reference in New Issue