diff --git a/profile/api.go b/profile/api.go index d563b5ae..6b0a6d94 100644 --- a/profile/api.go +++ b/profile/api.go @@ -36,7 +36,7 @@ func registerAPIEndpoints() error { if err := api.RegisterEndpoint(api.Endpoint{ Name: "Update Profile Icon", - Description: "Merge multiple profiles into a new one.", + Description: "Updates a profile icon.", Path: "profile/icon/update", Write: api.PermitUser, BelongsTo: module, diff --git a/sync/profile.go b/sync/profile.go index 34e8b625..984e3cff 100644 --- a/sync/profile.go +++ b/sync/profile.go @@ -48,7 +48,7 @@ type ProfileIcon struct { Value string `json:"value"` } -// ProfileIcon represents a profile fingerprint. +// ProfileFingerprint represents a profile fingerprint. type ProfileFingerprint struct { Type string `json:"type"` Key string `json:"key,omitempty"` @@ -165,12 +165,12 @@ func handleExportProfile(ar *api.Request) (data []byte, err error) { } func handleImportProfile(ar *api.Request) (any, error) { - var request *ProfileImportRequest + var request ProfileImportRequest // Get parameters. q := ar.URL.Query() if len(q) > 0 { - request = &ProfileImportRequest{ + request = ProfileImportRequest{ ImportRequest: ImportRequest{ ValidateOnly: q.Has("validate"), RawExport: string(ar.InputData), @@ -180,8 +180,7 @@ func handleImportProfile(ar *api.Request) (any, error) { AllowReplace: q.Has("allowReplace"), } } else { - request = &ProfileImportRequest{} - if err := json.Unmarshal(ar.InputData, request); err != nil { + if err := json.Unmarshal(ar.InputData, &request); err != nil { return nil, fmt.Errorf("%w: failed to parse import request: %w", ErrInvalidImportRequest, err) } } @@ -204,7 +203,7 @@ func handleImportProfile(ar *api.Request) (any, error) { } // Import. - return ImportProfile(request, profile.SourceLocal) + return ImportProfile(&request, profile.SourceLocal) } // ExportProfile exports a profile.