chore: replace all cn comments to en version by volc api (#313)
This commit is contained in:
@@ -267,7 +267,7 @@ func GetUploadAuthToken(ctx context.Context, c *app.RequestContext) {
|
||||
func createSecret(uid int64, fileType string) string {
|
||||
num := 10
|
||||
input := fmt.Sprintf("upload_%d_Ma*9)fhi_%d_gou_%s_rand_%d", uid, time.Now().Unix(), fileType, rand.Intn(100000))
|
||||
// 做md5,取前20个,// mapIntToBase62 把数字映射到 Base62
|
||||
// Do md5, take the first 20,//mapIntToBase62 map the number to Base62
|
||||
hash := sha256.Sum256([]byte(fmt.Sprintf("%s", input)))
|
||||
hashString := base64.StdEncoding.EncodeToString(hash[:])
|
||||
if len(hashString) > num {
|
||||
|
||||
@@ -138,7 +138,7 @@ func CreatePersonalAccessTokenAndPermission(ctx context.Context, c *app.RequestC
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// checkCPATParams 检查创建个人访问令牌的参数
|
||||
// checkCPATParams Check parameters for creating personal access tokens
|
||||
func checkCPATParams(ctx context.Context, req *openapiauth.CreatePersonalAccessTokenAndPermissionRequest) error {
|
||||
|
||||
if req.Name == "" {
|
||||
|
||||
@@ -159,7 +159,7 @@ func UserUpdateAvatar(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req passport.UserUpdateAvatarRequest
|
||||
|
||||
// 获取上传的文件
|
||||
// Get the uploaded file
|
||||
file, err := c.FormFile("avatar")
|
||||
if err != nil {
|
||||
logs.CtxErrorf(ctx, "Get Avatar Fail failed, err=%v", err)
|
||||
@@ -167,13 +167,13 @@ func UserUpdateAvatar(ctx context.Context, c *app.RequestContext) {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查文件类型
|
||||
// Check file type
|
||||
if !strings.HasPrefix(file.Header.Get("Content-Type"), "image/") {
|
||||
invalidParamRequestResponse(c, "invalid file type, only image allowed")
|
||||
return
|
||||
}
|
||||
|
||||
// 读取文件内容
|
||||
// Read file content
|
||||
src, err := file.Open()
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
|
||||
Reference in New Issue
Block a user