Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#58337] use correct link attachment upload

Eric Schubert40f801705855
diff --git a/frontend/src/app/core/state/attachments/attachments.service.ts b/frontend/src/app/core/state/attachments/attachments.service.ts
index ecea03ac046..abe51737b88 100644
--- a/frontend/src/app/core/state/attachments/attachments.service.ts
+++ b/frontend/src/app/core/state/attachments/attachments.service.ts
@@ -175,12 +175,12 @@ export class AttachmentsResourceService extends ResourceStoreService<IAttachment
*/
private getUploadTarget(resource:HalResource):string {
return this.getDirectUploadLink(resource)
- || AttachmentsResourceService.getAttachmentsSelfLink(resource)
+ || AttachmentsResourceService.getAddAttachmentsLink(resource)
|| this.apiV3Service.attachments.path;
}
private getDirectUploadLink(resource:HalResource):string|null {
- const links = resource.$links as unknown&{ prepareAttachment:HalLink };
+ const links = resource.$links as { prepareAttachment:HalLink };
if (links.prepareAttachment) {
return links.prepareAttachment.href as string;
@@ -194,10 +194,15 @@ export class AttachmentsResourceService extends ResourceStoreService<IAttachment
}
private static getAttachmentsSelfLink(resource:HalResource):string|null {
- const attachments = resource.attachments as unknown&{ href?:string };
+ const attachments = resource.attachments as { href?:string };
return attachments?.href || null;
}
+ private static getAddAttachmentsLink(resource:HalResource):string|null {
+ const link = resource.addAttachment as { href?:string };
+ return link?.href || null;
+ }
+
protected createStore():ResourceStore<IAttachment> {
return new AttachmentsStore();
}