Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d4c625

Browse files
committed
rc: config/unlock: rename parameter toconfigPassword accept old as well
We accidentally added a non `camelCase` parameter to the rc(`config_password`)- this fixes it (to `configPassword`) but acceptsthe old name too as it has been in a release.
1 parent4eccc40 commit6d4c625

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

‎fs/config/rc.go‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Unlocks the config file if it is locked.
2020
2121
Parameters:
2222
23-
- 'config_password' - password to unlock the config file
23+
- 'configPassword' - password to unlock the config file
2424
2525
A good idea is to disable AskPassword before making this call
2626
`,
@@ -30,9 +30,13 @@ A good idea is to disable AskPassword before making this call
3030
// Unlock the config file
3131
// A good idea is to disable AskPassword before making this call
3232
funcrcConfigPassword(ctx context.Context,in rc.Params) (out rc.Params,errerror) {
33-
configPass,err:=in.GetString("config_password")
33+
configPass,err:=in.GetString("configPassword")
3434
iferr!=nil {
35-
returnnil,err
35+
varerr2error
36+
configPass,err2=in.GetString("config_password")// backwards compat
37+
iferr2!=nil {
38+
returnnil,err
39+
}
3640
}
3741
ifSetConfigPassword(configPass)!=nil {
3842
returnnil,errors.New("failed to set config password")

‎fs/config/rc_test.go‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,26 @@ func TestRcPaths(t *testing.T) {
215215
funcTestRcConfigUnlock(t*testing.T) {
216216
call:=rc.Calls.Get("config/unlock")
217217
assert.NotNil(t,call)
218+
218219
in:= rc.Params{
219-
"config_password":"test",
220+
"configPassword":"test",
220221
}
221222
out,err:=call.Fn(context.Background(),in)
222223
require.NoError(t,err)
224+
assert.Nil(t,out)
223225

224-
assert.Nil(t,err)
226+
in= rc.Params{
227+
"config_password":"test",
228+
}
229+
out,err=call.Fn(context.Background(),in)
230+
require.NoError(t,err)
225231
assert.Nil(t,out)
226232

233+
in= rc.Params{
234+
"bad_config_password":"test",
235+
}
236+
out,err=call.Fn(context.Background(),in)
237+
require.Error(t,err)
238+
assert.ErrorContains(t,err,`Didn't find key "configPassword" in input`)
239+
assert.Nil(t,out)
227240
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp