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

"Index out of bounds" error where there are trailing spaces #13

Closed
vrurg opened this issue Apr 1, 2024 · 2 comments
Closed

"Index out of bounds" error where there are trailing spaces #13

vrurg opened this issue Apr 1, 2024 · 2 comments

Comments

@vrurg
Copy link

vrurg commented Apr 1, 2024

This is kind of a continuation to #12. With the following string used as test input:

    let src = r#"
app_dir: "$HOME/.var/app/foo"
logging:
    console:
        level: "debug"
    file:
        dest:
            path: "$HOME/.var/log/foo.log"
        options:
            pid: true

    "#;

I get the following error:

index out of bounds: the len is 187 but the index is 187

A workaround is to use src.trim_end() since the problem is in the trailing spaces before the "#.

@Genarito
Copy link
Member

Genarito commented Apr 1, 2024

Hi @vrurg , thank you very much for the report!

The problem was with some bugs when checking if I had reached the end of the file and the consideration of \r\n in Windows.
Fortunately, all those problems were solved and your case was added as a test to the library 🚀

The new versions are now available with the problems solved:

Greetings and thanks for using Gura! 😄

@vrurg
Copy link
Author

vrurg commented Apr 2, 2024

Thank you! Hopefully, this would also help merging Gura support into the config crate.

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

2 participants