Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docx.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ func ConvertDocx(r io.Reader) (string, map[string]string, error) {
meta := make(map[string]string)
var textHeader, textBody, textFooter string
for _, override := range contentTypeDefinition.Overrides {
f := zipFiles[override.PartName]
f, ok := zipFiles[override.PartName]
if !ok {
// Some docx files declare overrides for parts that are not
// present in the archive. Skip them rather than dereferencing
// a nil *zip.File and panicking.
continue
}

switch {
case override.ContentType == "application/vnd.openxmlformats-package.core-properties+xml":
Expand Down