fix(crawler): make sure includes/excludes is an array

This commit is contained in:
Gergő Móricz 2024-08-22 13:18:26 +02:00
parent 508568f943
commit fbbc3878f1

View File

@ -53,8 +53,8 @@ export class WebCrawler {
this.jobId = jobId; this.jobId = jobId;
this.initialUrl = initialUrl; this.initialUrl = initialUrl;
this.baseUrl = new URL(initialUrl).origin; this.baseUrl = new URL(initialUrl).origin;
this.includes = includes ?? []; this.includes = Array.isArray(includes) ? includes : [];
this.excludes = excludes ?? []; this.excludes = Array.isArray(excludes) ? excludes : [];
this.limit = limit; this.limit = limit;
this.robotsTxtUrl = `${this.baseUrl}/robots.txt`; this.robotsTxtUrl = `${this.baseUrl}/robots.txt`;
this.robots = robotsParser(this.robotsTxtUrl, ""); this.robots = robotsParser(this.robotsTxtUrl, "");