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

Make sure iframes in modals are not loaded multiple times

Benjamin Bädorfa39d9b0cc343
diff --git a/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts b/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts
index 6861f6eda60..c09a0ac9009 100644
--- a/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts
+++ b/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts
@@ -103,7 +103,13 @@ export class OpModalWrapperAugmentService {
const iframe = jQuery('<iframe frameborder="0" height="350" allowfullscreen>></iframe>');
iframe.attr('src', url);
- body.find(iframeSelector).append(iframe);
+ const iframeParent = body.find(iframeSelector);
+ if (iframeParent.find('iframe').length > 0) {
+ // Make sure we don't initialize the iframe multiple times
+ return body.html();
+ }
+
+ iframeParent.append(iframe);
return body.html();
}