diff --git a/coolq/cqcode.go b/coolq/cqcode.go index 01c5a6ecd..73717c80f 100644 --- a/coolq/cqcode.go +++ b/coolq/cqcode.go @@ -885,7 +885,7 @@ func (bot *CQBot) ConvertElement(spec *onebot.Spec, elem msg.Element, sourceType func (bot *CQBot) makeImageOrVideoElem(elem msg.Element, video bool, sourceType message.SourceType) (message.IMessageElement, error) { f := elem.Get("file") u := elem.Get("url") - if strings.HasPrefix(f, "http") { + if strings.HasPrefix(u, "http") { hash := md5.Sum([]byte(f)) cacheFile := path.Join(global.CachePath, hex.EncodeToString(hash[:])+".cache") maxSize := int64(maxImageSize) @@ -901,7 +901,7 @@ func (bot *CQBot) makeImageOrVideoElem(elem msg.Element, video bool, sourceType _ = os.Remove(cacheFile) } { - r := download.Request{URL: f, Limit: maxSize} + r := download.Request{URL: u, Limit: maxSize} if err := r.WriteToFileMultiThreading(cacheFile, thread); err != nil { return nil, err }