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

Upload empty file get "EOF" error #431

Closed
habohai opened this issue May 25, 2021 · 2 comments · Fixed by #438
Closed

Upload empty file get "EOF" error #431

habohai opened this issue May 25, 2021 · 2 comments · Fixed by #438
Assignees
Labels
bug v2 For resty v2

Comments

@habohai
Copy link

habohai commented May 25, 2021

	result := &app.AFSRetInfo{}
	url := fmt.Sprintf("http://%s/v1/game_volume/upload_file", u.Host)

	srcBytes, err := ioutil.ReadFile(u.SrcPath)
	if err != nil {
		s := fmt.Sprintf("UploadFileInfo.Do: ReadFile faild, url[%s] u[%+v] err[%v]", url, u, err)
		vlog.Error(s)
		return errors.New(s)
	}

	req := client.R().SetFormData(map[string]string{"file_path": u.DestPath}).
		SetFileReader("file", filepath.Base(u.SrcPath), bytes.NewReader(srcBytes)).
		SetContentLength(true).
		SetResult(result)

upload empty file error

ERROR	AStorage.UploadHandle: UpLoadFileList faild, err[UploadFileInfo.Do: faild, url[http://10.86.22.118:48885/v1/game_volume/upload_file] u[&{Host:10.86.22.118:48885 SrcPath:/Users/haibei/vrviuworks/code/be_gsm_tester/data/snapshot/area_user_game_data/2_642_1/data/Shooty Skies/moregames/kong DestPath:/data/data/test/kongfile/kong}] err[EOF]]	{"LAPP": "vm_game_planner", "LPID": 21068, "LFILE": "v1/android.go", "LLINE": 44, "LIP": ""}
@NathanBaulch
Copy link
Contributor

I stumbled on this same issue and have fixed it in PR #438.

@jeevatkm
Copy link
Member

Thank you @NathanBaulch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v2 For resty v2
Development

Successfully merging a pull request may close this issue.

3 participants