MCPcopy Index your code
hub / github.com/filebrowser/filebrowser / GetValues

Method GetValues

auth/hook.go:104–128  ·  view source on GitHub ↗

GetValues creates a map with values from the key-value format string

(s string)

Source from the content-addressed store, hash-verified

102
103// GetValues creates a map with values from the key-value format string
104func (a *HookAuth) GetValues(s string) {
105 m := map[string]string{}
106
107 // make line breaks consistent on Windows platform
108 s = strings.ReplaceAll(s, "\r\n", "\n")
109
110 // iterate input lines
111 for val := range strings.Lines(s) {
112 v := strings.SplitN(val, "=", 2)
113
114 // skips non key and value format
115 if len(v) != 2 {
116 continue
117 }
118
119 fieldKey := strings.TrimSpace(v[0])
120 fieldValue := strings.TrimSpace(v[1])
121
122 if a.Fields.IsValid(fieldKey) {
123 m[fieldKey] = fieldValue
124 }
125 }
126
127 a.Fields.Values = m
128}
129
130// SaveUser updates the existing user or creates a new one when not found
131func (a *HookAuth) SaveUser() (*users.User, error) {

Callers 1

RunCommandMethod · 0.95

Calls 1

IsValidMethod · 0.80

Tested by

no test coverage detected