Update electron to 13.1.2

This commit is contained in:
Fedor Indutny 2021-06-10 13:53:43 -07:00 committed by GitHub
parent 6e88c6aee1
commit df0aadc8a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

View file

@ -8,6 +8,8 @@ import * as path from 'path';
import AbortController from 'abort-controller';
import { MIMEType, IMAGE_JPEG } from '../../types/MIME';
import { typedArrayToArrayBuffer } from '../../Crypto';
import {
fetchLinkPreviewImage,
fetchLinkPreviewMetadata,
@ -1155,7 +1157,7 @@ describe('link preview fetching', () => {
new AbortController().signal
),
{
data: fixture.buffer,
data: typedArrayToArrayBuffer(fixture),
contentType: contentType as MIMEType,
}
);
@ -1240,7 +1242,7 @@ describe('link preview fetching', () => {
new AbortController().signal
),
{
data: fixture.buffer,
data: typedArrayToArrayBuffer(fixture),
contentType: IMAGE_JPEG,
}
);

View file

@ -13,6 +13,8 @@ import {
IMAGE_WEBP,
} from '../../types/MIME';
import { typedArrayToArrayBuffer } from '../../Crypto';
import { sniffImageMimeType } from '../../util/sniffImageMimeType';
describe('sniffImageMimeType', () => {
@ -89,7 +91,9 @@ describe('sniffImageMimeType', () => {
});
it('handles ArrayBuffers', async () => {
const arrayBuffer = (await fixture('kitten-1-64-64.jpg')).buffer;
const arrayBuffer = typedArrayToArrayBuffer(
await fixture('kitten-1-64-64.jpg')
);
assert.strictEqual(sniffImageMimeType(arrayBuffer), IMAGE_JPEG);
});
});

View file

@ -39,7 +39,11 @@ export function getAnimatedPngDataIfExists(
let numPlays: void | number;
const dataView = new DataView(bytes.buffer);
const dataView = new DataView(
bytes.buffer,
bytes.byteOffset,
bytes.byteLength
);
let i = PNG_SIGNATURE.length;
while (i < bytes.byteLength && i <= MAX_BYTES_TO_READ) {