Skip to content

Conversation

@haesuo566
Copy link
Contributor

@haesuo566 haesuo566 commented Nov 3, 2024

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.

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)
}

@appleboy appleboy added this to the v1.11 milestone Nov 6, 2024
@appleboy
Copy link
Member

appleboy commented Nov 6, 2024

@haesuo566 test error.

@haesuo566
Copy link
Contributor Author

@appleboy I’ve committed the fix for the issue where the permissions weren’t being set correctly due to the umask, which was causing the test to fail. Please review it.

@appleboy
Copy link
Member

appleboy commented Nov 7, 2024

@haesuo566 still failed in lint testing.

hso and others added 3 commits November 7, 2024 15:04
Squashed commit:

[75fe2b9] Fixed part where permissions could not be changed due to umask settings

[84b3770] refactor(context): Added a third, optional parameter for permissions to the SaveUploadedFile method. (#4068)
@haesuo566 haesuo566 closed this Nov 7, 2024
@haesuo566 haesuo566 reopened this Nov 7, 2024
@haesuo566 haesuo566 closed this Nov 7, 2024
@haesuo566 haesuo566 deleted the develop branch November 7, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants