Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] addSection does not escape XML unsafe characters #774

Closed
1 of 4 tasks
pimlottc-gov opened this issue Jun 19, 2020 · 3 comments
Closed
1 of 4 tasks

[BUG] addSection does not escape XML unsafe characters #774

pimlottc-gov opened this issue Jun 19, 2020 · 3 comments
Assignees
Milestone

Comments

@pimlottc-gov
Copy link

pimlottc-gov commented Jun 19, 2020

Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Version

Please specify what version of the library you are using: [ 3.2.1 ]

Please specify what version(s) of PowerPoint you are targeting: [ PowerPOint for Mac 16.16.23 (200615) ]

Steps to Reproduce

const title = "A < B";
ppt.addSection({ title });
ppt.addSlide({ sectionTitle: title })

Expected / Desired Behavior / Question

Slide appears section with title "A < B"

Observed Behavior

Output pptx file fails to open in PowerPoint:

PowerPoint found a problem with content in example.pptx

Examining the XML shows that title is used without escaping:

<p14:section name="A < B" id="...">

The title should be escaped to prevent XML parsing errors.

Workaround

Do the escaping yourself:

const title = "A &lt; B"
@pimlottc-gov
Copy link
Author

Having sections in our long deck is very nice, but got caught by this bug today and ended up losing a few hours before figuring out what had happened.

@gitbrent gitbrent self-assigned this Jun 23, 2020
@gitbrent gitbrent added this to the 3.3.0 milestone Jun 23, 2020
gitbrent added a commit that referenced this issue Jun 23, 2020
@gitbrent
Copy link
Owner

Thanks @pimlottc-gov

Sorry for the wasted hours - I should have had a test case for this.

Fixed in master, target v3.3.0

Screen Shot 2020-06-22 at 21 48 31

gitbrent added a commit that referenced this issue Jun 23, 2020
@pimlottc-gov
Copy link
Author

@gitbrent it's my fault for pushing code with multiple changes, got mislead as to what the real issue was. Unfortunately for all of us, PowerPoint is not very verbose about parsing errors.

Thanks for getting the fix in quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants