Browse Source

Added guard for empty tagset in utils

Anonymous 2 years ago
parent
commit
f3f5436bc3
  1. 1
      main.user.js
  2. 3
      src/utils.ts

1
main.user.js

@ -11437,6 +11437,7 @@
return {
embed_type: 2 /* MEDIA_EMBED */,
filename: fn,
tags: tags.length > 0 ? tags : void 0,
data: async (lsn) => import_buffer2.Buffer.from(await (await GM_fetch(pee, { headers: { "user-agent": "", range: `bytes=${ptr + 4 + thumbsize}-${size - 1}` } }, lsn)).arrayBuffer()),
thumbnail: thumb
};

3
src/utils.ts

@ -94,7 +94,7 @@ export const decodeCoom3Payload = async (buff: Buffer) : Promise<(EmbeddedFile |
const hasThumbnail = !!(flags & 4);
let [ptr, ptr2] = [hptr + 1, hptr + 1];
let fn = 'embedded';
let tags = [];
let tags : string[] = [];
let thumb: EmbeddedFile['thumbnail'] = Buffer.from(thumbnail);
if (hasFn) {
while (header[ptr2] != 0)
@ -115,6 +115,7 @@ export const decodeCoom3Payload = async (buff: Buffer) : Promise<(EmbeddedFile |
return {
embed_type: EMBED_TYPES.MEDIA_EMBED,
filename: fn,
tags: tags.length > 0 ? tags : undefined,
data: async (lsn) =>
Buffer.from(await (await GM_fetch(pee, { headers: { 'user-agent': '', range: `bytes=${ptr + 4 + thumbsize}-${size - 1}` } }, lsn)).arrayBuffer()),
thumbnail: thumb,

Loading…
Cancel
Save