merge: Fix federation error "The note creation failed with duplication error even when there is no duplication" (resolves #749) (!745)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/745

Closes #749

Approved-by: Tess K <me@thvxl.se>
Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
Hazelnoot 2024-11-22 10:37:11 +00:00
commit 2ac36e4a5c
1 changed files with 3 additions and 2 deletions

View File

@ -66,9 +66,10 @@ export class ApDbResolverService implements OnApplicationShutdown {
public parseUri(value: string | IObject | [string | IObject]): UriParseResult { public parseUri(value: string | IObject | [string | IObject]): UriParseResult {
const separator = '/'; const separator = '/';
const uri = new URL(getApId(value)); const apId = getApId(value);
const uri = new URL(apId);
if (this.utilityService.toPuny(uri.host) !== this.utilityService.toPuny(this.config.host)) { if (this.utilityService.toPuny(uri.host) !== this.utilityService.toPuny(this.config.host)) {
return { local: false, uri: uri.href }; return { local: false, uri: apId };
} }
const [, type, id, ...rest] = uri.pathname.split(separator); const [, type, id, ...rest] = uri.pathname.split(separator);