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

use api v3 attachments url at once intead of redirect

ulferts4bb8b9da132b
diff --git a/frontend/src/app/modules/ifc_models/xeokit-server.js b/frontend/src/app/modules/ifc_models/xeokit-server.js
index aaf4ee1ab52..f2853095536 100644
--- a/frontend/src/app/modules/ifc_models/xeokit-server.js
+++ b/frontend/src/app/modules/ifc_models/xeokit-server.js
@@ -40,10 +40,9 @@ class XeokitServer {
* @param error
*/
getMetadata(_projectId, modelId, done, error) {
- let attachmentId = window.gon.ifc_models.metadata_attachment_ids[modelId];
- const url = "/attachments/" + attachmentId + "/content";
- console.log("Loading model metadata: " + url);
- utils.loadJSON(url, done, error);
+ const attachmentId = window.gon.ifc_models.metadata_attachment_ids[modelId];
+ console.log(`Loading model metadata for: ${attachmentId}`);
+ utils.loadJSON(this.attachmentUrl(attachmentId), done, error);
}
/**
@@ -54,10 +53,13 @@ class XeokitServer {
* @param error
*/
getGeometry(projectId, modelId, done, error) {
- let attachmentId = window.gon.ifc_models.xkt_attachment_ids[modelId];
- const url = "/attachments/" + attachmentId + "/content";
- console.log("Loading model geometry: " + url);
- utils.loadArraybuffer(url, done, error);
+ const attachmentId = window.gon.ifc_models.xkt_attachment_ids[modelId];
+ console.log(`Loading model geometry for: ${attachmentId}`);
+ utils.loadArraybuffer(this.attachmentUrl(attachmentId), done, error);
+ }
+
+ attachmentUrl(attachmentId) {
+ return "/api/v3/attachments/" + attachmentId + "/content";
}
}