mirror of
https://github.com/mjl-/mox.git
synced 2025-06-28 05:08:14 +03:00
webmail: fix nil pointer dereference when searching for attachment types, eg "a:spreadsheet"
for issue #272 by mattfbacon
This commit is contained in:
parent
008de1cafb
commit
0203dfa9d9
@ -645,7 +645,7 @@ var ErrParamEncoding = errors.New("bad header parameter encoding")
|
|||||||
func (p *Part) DispositionFilename() (disposition string, filename string, err error) {
|
func (p *Part) DispositionFilename() (disposition string, filename string, err error) {
|
||||||
h, err := p.Header()
|
h, err := p.Header()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", fmt.Errorf("parsing header: %v", err)
|
return "", "", fmt.Errorf("parsing header: %w", err)
|
||||||
}
|
}
|
||||||
var disp string
|
var disp string
|
||||||
var params map[string]string
|
var params map[string]string
|
||||||
|
@ -1803,7 +1803,7 @@ func (q Query) attachmentFilterFn(log mlog.Log, acc *store.Account, state *msgSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
return func(m store.Message) bool {
|
return func(m store.Message) bool {
|
||||||
if !state.ensurePart(m, false) {
|
if !state.ensurePart(m, true) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
types, err := attachmentTypes(log, m, state)
|
types, err := attachmentTypes(log, m, state)
|
||||||
@ -1872,7 +1872,7 @@ func attachmentTypes(log mlog.Log, m store.Message, state *msgState) (map[Attach
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
_, filename, err := a.Part.DispositionFilename()
|
_, filename, err := a.Part.DispositionFilename()
|
||||||
if err != nil && errors.Is(err, message.ErrParamEncoding) {
|
if err != nil && (errors.Is(err, message.ErrParamEncoding) || errors.Is(err, message.ErrHeader)) {
|
||||||
log.Debugx("parsing disposition/filename", err)
|
log.Debugx("parsing disposition/filename", err)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return nil, fmt.Errorf("reading disposition/filename: %v", err)
|
return nil, fmt.Errorf("reading disposition/filename: %v", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user