Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix send file from url #106

Merged
merged 1 commit into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions wechaty-puppet/filebox/file_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ type fileImplInterface interface {

// FileBox struct
type FileBox struct {
fileImpl fileImplInterface
Name string
metadata map[string]interface{}
boxType Type
mimeType string
fileImpl fileImplInterface
Name string
metadata map[string]interface{}
boxType Type
mimeType string
}

func newFileBox(common *OptionsCommon, fileImpl fileImplInterface) *FileBox {
Expand Down Expand Up @@ -127,10 +127,10 @@ func (fb *FileBox) ToJSON() (string, error) {
jsonMap := map[string]interface{}{
"name": fb.Name,
"metadata": fb.metadata,
"boxType": fb.boxType,
"type": fb.boxType,
}
switch fb.boxType {
case TypeUrl,TypeQRCode,TypeBase64:
case TypeUrl, TypeQRCode, TypeBase64:
default:
return "", ErrToJSON
}
Expand Down
4 changes: 2 additions & 2 deletions wechaty-puppet/filebox/file_box_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func newFileBoxUrl(remoteUrl string, headers http.Header) *fileBoxUrl {

func (fb *fileBoxUrl) toJSONMap() map[string]interface{} {
return map[string]interface{}{
"headers": fb.headers,
"remoteUrl": fb.remoteUrl,
"headers": fb.headers,
"url": fb.remoteUrl,
}
}

Expand Down