MCPcopy Create free account
hub / github.com/kopia/kopia / handleSetUIPreferences

Function handleSetUIPreferences

internal/server/api_ui_pref.go:49–62  ·  view source on GitHub ↗
(_ context.Context, rc requestContext)

Source from the content-addressed store, hash-verified

47}
48
49func handleSetUIPreferences(_ context.Context, rc requestContext) (any, *apiError) {
50 var p serverapi.UIPreferences
51
52 // verify the JSON is valid by unmarshaling it
53 if err := json.Unmarshal(rc.body, &p); err != nil {
54 return nil, requestError(serverapi.ErrorMalformedRequest, "malformed request")
55 }
56
57 if err := atomic.WriteFile(rc.srv.getOptions().UIPreferencesFile, bytes.NewReader(rc.body)); err != nil {
58 return nil, internalServerError(err)
59 }
60
61 return serverapi.Empty{}, nil
62}

Callers

nothing calls this directly

Calls 4

requestErrorFunction · 0.85
internalServerErrorFunction · 0.85
WriteFileMethod · 0.65
getOptionsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…