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
|
@ -3,11 +3,7 @@ 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 Logger from "@/services/logger.js";
|
||||||
import {Instances} from "@/models/index.js";
|
import {Instances} from "@/models/index.js";
|
||||||
import {
|
import {apRequestChart, federationChart, instanceChart,} from "@/services/chart/index.js";
|
||||||
apRequestChart,
|
|
||||||
federationChart,
|
|
||||||
instanceChart,
|
|
||||||
} from "@/services/chart/index.js";
|
|
||||||
import {fetchInstanceMetadata} from "@/services/fetch-instance-metadata.js";
|
import {fetchInstanceMetadata} from "@/services/fetch-instance-metadata.js";
|
||||||
import {toPuny} from "@/misc/convert-host.js";
|
import {toPuny} from "@/misc/convert-host.js";
|
||||||
import {StatusError} from "@/misc/fetch.js";
|
import {StatusError} from "@/misc/fetch.js";
|
||||||
|
@ -20,7 +16,14 @@ const logger = new Logger("deliver");
|
||||||
let latest: string | null = null;
|
let latest: string | null = null;
|
||||||
|
|
||||||
export default async (job: Bull.Job<DeliverJobData>) => {
|
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);
|
const puny = toPuny(host);
|
||||||
|
|
||||||
if (await shouldSkipInstance(puny)) return "skip";
|
if (await shouldSkipInstance(puny)) return "skip";
|
||||||
|
|
Loading…
Reference in New Issue