Skip to content

Commit

Permalink
fix: multiple OLEs, same ext type, same slide.
Browse files Browse the repository at this point in the history
  • Loading branch information
MP70 committed Oct 24, 2024
1 parent c772f40 commit b456f34
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/shapes/ole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,14 @@ export class OLEObject extends Shape {

const types = contentTypesXml.getElementsByTagName('Types')[0];
const fileExtension = this.getFileExtension(this.oleObjectPath);
const partName = `/ppt/embeddings/${this.createdRid}${fileExtension}`;
const existingOverride = Array.from(types.getElementsByTagName('Override')).find(
(override) => override.getAttribute('PartName').endsWith(fileExtension)
(override) => override.getAttribute('PartName') === partName
);

if (!existingOverride) {
const newOverride = contentTypesXml.createElement('Override');
newOverride.setAttribute('PartName', `/ppt/embeddings/${this.createdRid}${fileExtension}`);
newOverride.setAttribute('PartName', partName);
newOverride.setAttribute('ContentType', this.getContentType(fileExtension));
types.appendChild(newOverride);

Expand Down

0 comments on commit b456f34

Please sign in to comment.