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

refactor(context): (reupload) Added an optional permission parameter to the SaveUploadedFile method (#4068) #4088

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haesuo566
Copy link

The SaveUploadedFile method previously set folder permissions to 0o750 by default when creating directories. A third parameter, ...fs.FileMode, has been added to allow customizable permissions. This update enables users to optionally set folder permissions when creating directories and files with the SaveUploadedFile method.

// example
func SaveFile(ctx *gin.Context) error {
	file, err := ctx.FormFile("file")
	if err != nil {
		return err
	}

	var perm fs.FileMode = 0o755
	return ctx.SaveUploadedFile(file, "/asset/file", perm)
}

image

@haesuo566 haesuo566 changed the title refactor(context): Added an optional permission parameter to the SaveUploadedFile method (#4068) refactor(context): (reupload) Added an optional permission parameter to the SaveUploadedFile method (#4068) Nov 7, 2024
Copy link

codecov bot commented Nov 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.93%. Comparing base (3dc1cd6) to head (62a6522).
Report is 79 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4088      +/-   ##
==========================================
- Coverage   99.21%   98.93%   -0.28%     
==========================================
  Files          42       44       +2     
  Lines        3182     3393     +211     
==========================================
+ Hits         3157     3357     +200     
- Misses         17       25       +8     
- Partials        8       11       +3     
Flag Coverage Δ
?
-tags "sonic avx" 98.93% <100.00%> (?)
-tags go_json 98.93% <100.00%> (?)
-tags nomsgpack 98.92% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 98.93% <100.00%> (-0.28%) ⬇️
go-1.22 98.93% <100.00%> (?)
macos-latest 98.93% <100.00%> (-0.28%) ⬇️
ubuntu-latest 98.93% <100.00%> (-0.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant