Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs LoadFile will lose the first '\' when config file's value is '\1\n\t%p\t%r\t%u\t%d\t%t\t%e\t%T\t%S\t%U\t%E\t\t' #68

Open
xlife8 opened this issue Mar 1, 2023 · 0 comments

Comments

@xlife8
Copy link

xlife8 commented Mar 1, 2023

example.conf

log_line_prefix='\1\n\t%p\t%r\t%u\t%d\t%t\t%e\t%T\t%S\t%U\t%E\t\t'

After I run this golang code:

import (
	"fmt"
	"github.com/magiconair/properties"
        "os"
)

func main() {
        confName := "example.conf"
        filePros, _ := properties.LoadFile(confName, properties.UTF8)
        stat, _ := os.Stat(confName)
        writer, _ := os.OpenFile(confName, os.O_WRONLY|os.O_TRUNC, stat.Mode())
        defer writer.Close()
        filePros.WriteSeparator = "="
        filePros.Write(writer, properties.UTF8)
}

The example.conf content is change to this:

log_line_prefix='1\n\t%p\t%r\t%u\t%d\t%t\t%e\t%T\t%S\t%U\t%E\t\t'

The value's first '\' character lost, I think this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant