Skip to content

Commit

Permalink
Fix #366
Browse files Browse the repository at this point in the history
  • Loading branch information
hhrutter committed Aug 8, 2021
1 parent 5e1ae87 commit befba81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions pkg/pdfcpu/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ func prevalidateDate(s string, relaxed bool) (string, bool) {
s = utf16s
}

// Remove trailing 0x00
s = strings.TrimRight(s, "\x00")

if relaxed {
// Accept missing "D:" prefix.
// "YYYY" is mandatory
if strings.HasPrefix(s, "D:") {
s = s[2:]
}
s = strings.TrimPrefix(s, "D:")
return s, len(s) >= 4
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/pdfcpu/validate/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,9 @@ func validateBooleanArrayEntry(xRefTable *pdf.XRefTable, d pdf.Dict, dictName, e

func validateDateObject(xRefTable *pdf.XRefTable, o pdf.Object, sinceVersion pdf.Version) (string, error) {
s, err := xRefTable.DereferenceStringOrHexLiteral(o, sinceVersion, nil)
//sl, err := xRefTable.DereferenceStringLiteral(o, sinceVersion, nil)
if err != nil {
return "", err
}
//s := sl.Value()
if s == "" {
return s, nil
}
Expand Down

0 comments on commit befba81

Please sign in to comment.