fix: Prevent trying to access nil maps in PAXHeaders

This commit is contained in:
Felicitas Pojtinger
2021-12-20 22:09:19 +01:00
parent 07c0abff55
commit 2c3646aaa6

View File

@@ -12,6 +12,9 @@ func DBHeaderToTarHeader(dbhdr *models.Header) (*tar.Header, error) {
if err := json.Unmarshal([]byte(dbhdr.Paxrecords), &paxRecords); err != nil {
return nil, err
}
if paxRecords == nil {
paxRecords = map[string]string{}
}
hdr := &tar.Header{
Typeflag: byte(dbhdr.Typeflag),