be more specific about attachment mediatype lookup
This commit is contained in:
parent
140c4d8854
commit
22ea1b382f
10
activity.go
10
activity.go
|
@ -730,10 +730,16 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
if !ok {
|
if !ok {
|
||||||
if uu, ok := ua[0].(junk.Junk); ok {
|
if uu, ok := ua[0].(junk.Junk); ok {
|
||||||
u, _ = uu.GetString("href")
|
u, _ = uu.GetString("href")
|
||||||
|
if mt == "" {
|
||||||
|
mt, _ = uu.GetString("mediaType")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if uu, ok := att.GetMap("url"); ok {
|
} else if uu, ok := att.GetMap("url"); ok {
|
||||||
u, _ = uu.GetString("href")
|
u, _ = uu.GetString("href")
|
||||||
|
if mt == "" {
|
||||||
|
mt, _ = uu.GetString("mediaType")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
name, _ := att.GetString("name")
|
name, _ := att.GetString("name")
|
||||||
|
@ -745,10 +751,6 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
if numatts > 4 {
|
if numatts > 4 {
|
||||||
log.Printf("excessive attachment: %s", at)
|
log.Printf("excessive attachment: %s", at)
|
||||||
} else if at == "Document" || at == "Image" {
|
} else if at == "Document" || at == "Image" {
|
||||||
if mt == "" {
|
|
||||||
log.Printf("assuming image media")
|
|
||||||
mt = "image/jpeg"
|
|
||||||
}
|
|
||||||
mt = strings.ToLower(mt)
|
mt = strings.ToLower(mt)
|
||||||
log.Printf("attachment: %s %s", mt, u)
|
log.Printf("attachment: %s %s", mt, u)
|
||||||
if mt == "text/plain" || mt == "application/pdf" ||
|
if mt == "text/plain" || mt == "application/pdf" ||
|
||||||
|
|
Loading…
Reference in New Issue