use blob instead of stream to get file list. fixes #1084

This commit is contained in:
Danny Coates 2019-01-10 11:10:36 -08:00
parent 4a633c8930
commit 8e8570c357
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
2 changed files with 3 additions and 2 deletions

View file

@ -375,7 +375,8 @@ export async function getFileList(bearerToken) {
const headers = new Headers({ Authorization: `Bearer ${bearerToken}` }); const headers = new Headers({ Authorization: `Bearer ${bearerToken}` });
const response = await fetch(getApiUrl('/api/filelist'), { headers }); const response = await fetch(getApiUrl('/api/filelist'), { headers });
if (response.ok) { if (response.ok) {
return response.body; // stream const encrypted = await response.blob();
return encrypted;
} }
throw new Error(response.status); throw new Error(response.status);
} }

View file

@ -131,7 +131,7 @@ export default class User {
try { try {
const encrypted = await getFileList(this.bearerToken); const encrypted = await getFileList(this.bearerToken);
const decrypted = await streamToArrayBuffer( const decrypted = await streamToArrayBuffer(
decryptStream(encrypted, b64ToArray(this.info.fileListKey)) decryptStream(blobStream(encrypted), b64ToArray(this.info.fileListKey))
); );
list = JSON.parse(textDecoder.decode(decrypted)); list = JSON.parse(textDecoder.decode(decrypted));
} catch (e) { } catch (e) {