@opentermsarchive/engine 9.1.0 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -18,7 +18,7 @@ export { ExtractDocumentError } from './errors.js';
18
18
  */
19
19
  export default async function extract(sourceDocument) {
20
20
  try {
21
- if (sourceDocument.mimeType == mime.getType('pdf')) {
21
+ if (mime.getExtension(sourceDocument.mimeType) == 'pdf') {
22
22
  return await extractFromPDF(sourceDocument);
23
23
  }
24
24
 
@@ -534,6 +534,10 @@ describe('Extract', () => {
534
534
  expect(await extract({ content: pdfContent, mimeType: mime.getType('pdf') })).to.equal(expectedExtractedContent);
535
535
  });
536
536
 
537
+ it('extracts content from PDF when MIME type includes charset parameter', async () => {
538
+ expect(await extract({ content: pdfContent, mimeType: 'application/pdf; charset=utf-8' })).to.equal(expectedExtractedContent);
539
+ });
540
+
537
541
  context('when PDF contains no text', () => {
538
542
  it('throws an ExtractDocumentError error', async () => {
539
543
  await expect(extract({ content: await fs.readFile(path.resolve(__dirname, '../../../test/fixtures/termsWithoutText.pdf')), mimeType: mime.getType('pdf') })).to.be.rejectedWith(ExtractDocumentError, /contains no text/);