Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ func (k *Key) transformValue(val string) string {
}

// Take off leading '%(' and trailing ')s'.
noption := strings.TrimLeft(vr, "%(")
noption = strings.TrimRight(noption, ")s")
noption := vr[2 : len(vr)-2]

// Search in the same section.
nk, err := k.s.GetKey(noption)
Expand Down
5 changes: 4 additions & 1 deletion key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,13 @@ func TestRecursiveValues(t *testing.T) {
Convey("Recursive values should not reflect on same key", t, func() {
f, err := ini.Load([]byte(`
NAME = ini
expires = yes
[package]
NAME = %(NAME)s`))
NAME = %(NAME)s
expires = %(expires)s`))
So(err, ShouldBeNil)
So(f, ShouldNotBeNil)
So(f.Section("package").Key("NAME").String(), ShouldEqual, "ini")
So(f.Section("package").Key("expires").String(), ShouldEqual, "yes")
})
}