URL parse check in deliver queue
ci/woodpecker/tag/ociImageTag Pipeline is running
Details
ci/woodpecker/tag/ociImageTag Pipeline is running
Details
This commit is contained in:
parent
6a66010294
commit
e7ff3a81bb
|
@ -1,18 +1,14 @@
|
|||
import { URL } from "node:url";
|
||||
import {URL} from "node:url";
|
||||
import request from "@/remote/activitypub/request.js";
|
||||
import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js";
|
||||
import {registerOrFetchInstanceDoc} from "@/services/register-or-fetch-instance-doc.js";
|
||||
import Logger from "@/services/logger.js";
|
||||
import { Instances } from "@/models/index.js";
|
||||
import {
|
||||
apRequestChart,
|
||||
federationChart,
|
||||
instanceChart,
|
||||
} from "@/services/chart/index.js";
|
||||
import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js";
|
||||
import { toPuny } from "@/misc/convert-host.js";
|
||||
import { StatusError } from "@/misc/fetch.js";
|
||||
import { shouldSkipInstance } from "@/misc/skipped-instances.js";
|
||||
import type { DeliverJobData } from "@/queue/types.js";
|
||||
import {Instances} from "@/models/index.js";
|
||||
import {apRequestChart, federationChart, instanceChart,} from "@/services/chart/index.js";
|
||||
import {fetchInstanceMetadata} from "@/services/fetch-instance-metadata.js";
|
||||
import {toPuny} from "@/misc/convert-host.js";
|
||||
import {StatusError} from "@/misc/fetch.js";
|
||||
import {shouldSkipInstance} from "@/misc/skipped-instances.js";
|
||||
import type {DeliverJobData} from "@/queue/types.js";
|
||||
import type Bull from "bull";
|
||||
|
||||
const logger = new Logger("deliver");
|
||||
|
@ -20,7 +16,14 @@ const logger = new Logger("deliver");
|
|||
let latest: string | null = null;
|
||||
|
||||
export default async (job: Bull.Job<DeliverJobData>) => {
|
||||
const { host } = new URL(job.data.to);
|
||||
let host: string;
|
||||
try {
|
||||
host = new URL(job.data.to).host;
|
||||
} catch (e) {
|
||||
logger.error(`Failed URL parse: ${JSON.stringify(job.data)}`);
|
||||
return "skip";
|
||||
}
|
||||
|
||||
const puny = toPuny(host);
|
||||
|
||||
if (await shouldSkipInstance(puny)) return "skip";
|
||||
|
|
Loading…
Reference in New Issue