Skip to content

Commit 8707213

Browse files
committed
Drop Adobe Illustrator (.ai) detection support
1 parent 0743dd4 commit 8707213

7 files changed

+1
-13067
lines changed

core.js

+1-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Primary entry point, Node.js specific entry point is index.js
55
import * as Token from 'token-types';
66
import * as strtok3 from 'strtok3/core';
77
import {ZipHandler} from '@tokenizer/inflate';
8-
import {includes, getUintBE} from 'uint8array-extras';
8+
import {getUintBE} from 'uint8array-extras';
99
import {
1010
stringToBytes,
1111
tarHeaderChecksumMatches,
@@ -718,28 +718,6 @@ export class FileTypeParser {
718718
}
719719

720720
if (this.checkString('%PDF')) {
721-
try {
722-
const skipBytes = 1350;
723-
if (skipBytes === await tokenizer.ignore(skipBytes)) {
724-
const maxBufferSize = 10 * 1024 * 1024;
725-
const buffer = new Uint8Array(Math.min(maxBufferSize, tokenizer.fileInfo.size - skipBytes));
726-
await tokenizer.readBuffer(buffer, {mayBeLess: true});
727-
728-
// Check if this is an Adobe Illustrator file
729-
if (includes(buffer, new TextEncoder().encode('AIPrivateData'))) {
730-
return {
731-
ext: 'ai',
732-
mime: 'application/postscript',
733-
};
734-
}
735-
}
736-
} catch (error) {
737-
// Swallow end of stream error if file is too small for the Adobe AI check
738-
if (!(error instanceof strtok3.EndOfStreamError)) {
739-
throw error;
740-
}
741-
}
742-
743721
// Assume this is just a normal PDF
744722
return {
745723
ext: 'pdf',

fixture/fixture-normal.ai

-6,465
This file was deleted.

fixture/fixture-without-pdf-compatibility.ai

-6,572
This file was deleted.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@
197197
"it",
198198
"s3m",
199199
"xm",
200-
"ai",
201200
"skp",
202201
"avif",
203202
"eps",

readme.md

-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
436436
- [`aac`](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) - Advanced Audio Coding
437437
- [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File
438438
- [`ace`](https://en.wikipedia.org/wiki/ACE_(compressed_file_format)) - ACE archive
439-
- [`ai`](https://en.wikipedia.org/wiki/Adobe_Illustrator_Artwork) - Adobe Illustrator Artwork
440439
- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file
441440
- [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file
442441
- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec

supported.js

-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ export const extensions = [
127127
'it',
128128
's3m',
129129
'xm',
130-
'ai',
131130
'skp',
132131
'avif',
133132
'eps',

test.js

-4
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ const names = {
216216
'fixture.wma',
217217
'fixture.wmv',
218218
],
219-
ai: [
220-
'fixture-normal', // Normal AI
221-
'fixture-without-pdf-compatibility', // AI without the PDF compatibility (cannot be opened by PDF viewers I guess)
222-
],
223219
jxl: [
224220
'fixture', // Image data stored within JXL container
225221
'fixture2', // Bare image data with no container

0 commit comments

Comments
 (0)