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

Add part-level diff when package manifests don't match (more or fewer parts) #5

Open
Fake51 opened this issue Sep 5, 2017 · 5 comments

Comments

@Fake51
Copy link

Fake51 commented Sep 5, 2017

I have a repaired powerpoint file where the repair apparently consisted in removing a .xml.rel file. When trying to diff the problematic and the repaired file, opc fails with the following exception:

KeyError: "No item with name 'ppt/slideLayouts/_rels/slideLayout2.xml.rels'"

The file exists in the first file, but not in the second

@scanny
Copy link
Contributor

scanny commented Sep 5, 2017

What opc command are you running when this happens?

@Fake51
Copy link
Author

Fake51 commented Sep 5, 2017

I'm running

opc diff [problematic.pptx] [fixed.pptx]

To underline the issue, things work if I switch the order of the files - presumably because things are diffed by checking each [old-file] against [new-files]. I haven't looked into the code for it yet, apart from doublechecking that the .pptx files were actually read correctly

@scanny
Copy link
Contributor

scanny commented Sep 5, 2017

Yes, I think that's right. The code isn't sophisticated enough to deal with "package-level" differences, i.e. different members in the two zip-archives.

I vaguely remember considering a package-level diff sub-command right around the time I ran out of energy to add more to this :)

@Fake51
Copy link
Author

Fake51 commented Sep 5, 2017

Well, the tool came in handy for me today (thanks a lot, by the way), so might have a look at a patch, if I can find the time.

And thanks a lot both for responding, and doing so quickly!

@scanny
Copy link
Contributor

scanny commented Sep 5, 2017

Of course :)

opc-diag is a daily-use tool for me, I just got to the point where it did what I needed and I lost interest in extending it. I think the most frequent use for me is exploring an XML part in a package (.pptx for me usually) without having to unzip and reformat it and especially to clean up the file-space afterward. My favorite command is:

opc browse some.pptx somePart1.xml | vim -

Using this it's super fast to get into a code-folded view of the XML so I can see how the elements of interest are structured, either by PowerPoint at analysis time or me at implementation time. It's also handy at debugging time to diagnose a file that's behaving unexpectedly :)

@scanny scanny changed the title Diff fails when before and after files don't match in content Add part-level diff when package manifests don't match (more or fewer parts) Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants