Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -15,8 +15,8 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
// Pull in the encryption lib so that we can decrypt attachments.
|
||||
import encrypt from 'matrix-encrypt-attachment';
|
||||
import { parseErrorResponse } from 'matrix-js-sdk/src/http-api';
|
||||
import encrypt from "matrix-encrypt-attachment";
|
||||
import { parseErrorResponse } from "matrix-js-sdk/src/http-api";
|
||||
|
||||
import { mediaFromContent } from "../customisations/Media";
|
||||
import { IEncryptedFile, IMediaEventInfo } from "../customisations/models/IMediaEventContent";
|
||||
|
@ -47,10 +47,7 @@ export class DecryptError extends Error {
|
|||
* @param {IMediaEventInfo} info The info parameter taken from the matrix event.
|
||||
* @returns {Promise<Blob>} Resolves to a Blob of the file.
|
||||
*/
|
||||
export async function decryptFile(
|
||||
file: IEncryptedFile,
|
||||
info?: IMediaEventInfo,
|
||||
): Promise<Blob> {
|
||||
export async function decryptFile(file: IEncryptedFile, info?: IMediaEventInfo): Promise<Blob> {
|
||||
const media = mediaFromContent({ file });
|
||||
|
||||
let responseData: ArrayBuffer;
|
||||
|
@ -74,7 +71,7 @@ export async function decryptFile(
|
|||
// they introduce XSS attacks if the Blob URI is viewed directly in the
|
||||
// browser (e.g. by copying the URI into a new tab or window.)
|
||||
// See warning at top of file.
|
||||
let mimetype = info?.mimetype ? info.mimetype.split(";")[0].trim() : '';
|
||||
let mimetype = info?.mimetype ? info.mimetype.split(";")[0].trim() : "";
|
||||
mimetype = getBlobSafeMimeType(mimetype);
|
||||
|
||||
return new Blob([dataArray], { type: mimetype });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue