qiniu / go-sdk

golang sdk
MIT License
137 stars 63 forks source link

extra is nil,runtime error: invalid memory address or nil pointer dereference #81

Closed zituocn closed 1 year ago

zituocn commented 1 year ago

storage/form_upload.go

line:398

原始代码

      //extra.Params
    if extra.Params != nil {
        for k, v := range extra.Params {
            if (strings.HasPrefix(k, "x:") || strings.HasPrefix(k, "x-qn-meta-")) && v != "" {
                err = writer.WriteField(k, v)
                if err != nil {
                    return
                }
            }
        }
    }

修正后的

      //extra.Params
    if extra!=nil&&extra.Params != nil {
        for k, v := range extra.Params {
            if (strings.HasPrefix(k, "x:") || strings.HasPrefix(k, "x-qn-meta-")) && v != "" {
                err = writer.WriteField(k, v)
                if err != nil {
                    return
                }
            }
        }
    }
YangSen-qn commented 1 year ago

感谢您的反馈

bachue commented 1 year ago

fixed in v7.15.0

zituocn commented 1 year ago

fixed in v7.15.0

NICE