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

Improve keys function for keys with extra newlines #249

Closed
wants to merge 1 commit into from

Conversation

c4710n
Copy link

@c4710n c4710n commented Mar 15, 2024

This PR improves keys function to make it more robust.


Sometimes, keys contains "\n" at the tail of themselves. In that case, keys function will return content like:

ssh-ed25519 ...
          # <- here is an extra \n
ssh-ed25519 ...

When other functions use the result of keys function, it may leads errors. Let's say here, it will build bad arguments:

--recipient 'ssh-ed25519...' --recipient '' --recipient 'ssh-ed25519...'
                                         |
                                        bad

which will lead an error:

age: error: unknown recipient type: ""

This PR uses gnused to remove the empty lines in the list of keys, which make it more robust.

@martijnboers
Copy link

I have this issue when I'm using builtins.readFile to read my pub files and my editor adds a newline to the .pub files. Minor, but would be great if this was fixed.

@zowoq
Copy link

zowoq commented May 25, 2024

This should have been resolved by #256.

@c4710n c4710n closed this May 25, 2024
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

Successfully merging this pull request may close these issues.

3 participants