EncFS array paths
This commit is contained in:
parent
3beb008969
commit
7c0e1bfbcf
@ -279,11 +279,13 @@ EncFS.fromPassword = async function(fs, password) {
|
|||||||
return String.fromCharCode.apply(null, new Uint8Array(res));
|
return String.fromCharCode.apply(null, new Uint8Array(res));
|
||||||
}
|
}
|
||||||
async function path_encrypt(data) {
|
async function path_encrypt(data) {
|
||||||
return (await Promise.all(data.split('/').map(x => path_component_encrypt(x)))).join('/');
|
if((data) && (data.constructor === Array)) return await Promise.all(data.map(x => path_component_encrypt(x)));
|
||||||
|
else return (await Promise.all(data.split('/').map(x => path_component_encrypt(x)))).join('/');
|
||||||
}
|
}
|
||||||
async function path_decrypt(data) {
|
async function path_decrypt(data) {
|
||||||
if(data.startsWith('/')) return '/' + await path_decrypt(data.replace(/^\/+/g, ''));
|
if((data) && (data.constructor === Array)) return await Promise.all(data.map(x => path_component_decrypt(x)));
|
||||||
return (await Promise.all(data.split('/').map(x => path_component_decrypt(x)))).join('/');
|
else if(data.startsWith('/')) return '/' + await path_decrypt(data.replace(/^\/+/g, ''));
|
||||||
|
else return (await Promise.all(data.split('/').map(x => path_component_decrypt(x)))).join('/');
|
||||||
}
|
}
|
||||||
return new EncFS((await fs.mkdir('ZZZE ' + uint8array_to_b64(new Uint8Array(await digest('SHA-1', password))))).chroot(), data_encrypt, data_decrypt, path_encrypt, path_decrypt);
|
return new EncFS((await fs.mkdir('ZZZE ' + uint8array_to_b64(new Uint8Array(await digest('SHA-1', password))))).chroot(), data_encrypt, data_decrypt, path_encrypt, path_decrypt);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user