Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import type { ApifyEnv } from 'apify';
import { Actor } from 'apify';
import type { HTTPResponse, Page } from 'puppeteer';
import contentType from 'content-type';
import { parse as parseContentType } from 'content-type';
// @ts-expect-error no typings
import DevToolsServer from 'devtools-server';
import { getInjectableScript } from 'idcac-playwright';
Expand Down Expand Up @@ -660,7 +660,7 @@ export class CrawlerSetup implements CrawlerSetupOptions {

const cTypeHeader = response.headers()['content-type'];
try {
const { type } = contentType.parse(cTypeHeader);
const { type } = parseContentType(cTypeHeader);
if (!/^(text|application)\/xml$|\+xml$/.test(type)) return;
} catch {
// Invalid type is not XML.
Expand Down
4 changes: 2 additions & 2 deletions packages/scraper-tools/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import type { ApifyEnv } from 'apify';
import { Actor } from 'apify';
import type { ContentType } from 'content-type';
import contentTypeParser from 'content-type';
import { format as formatContentType } from 'content-type';

import log from '@apify/log';

Expand Down Expand Up @@ -114,7 +114,7 @@
return saveSnapshot({
page: this.page as SnapshotOptions['page'],
body: this.body as SnapshotOptions['body'],
contentType: this.contentType ? contentTypeParser.format(this.contentType as ContentType) : null,
contentType: this.contentType ? formatContentType(this.contentType as ContentType) : null,
json: this.json,
});
}
Expand All @@ -141,7 +141,7 @@
const defaultUserData = {
[META_KEY]: {
parentRequestId: castedRequest.id || castedRequest.uniqueKey,
depth: (castedRequest.userData?.[META_KEY] as RequestMetadata).depth ?? 0 + 1,

Check warning on line 144 in packages/scraper-tools/src/context.ts

View workflow job for this annotation

GitHub Actions / Lint

eslint(no-unsafe-optional-chaining)

packages/scraper-tools/src/context.ts:144:25: Unsafe usage of optional chaining
},
};

Expand Down
Loading