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

trurl: allow "control bytes" in JSON output #333

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

bagder
Copy link
Member

@bagder bagder commented Aug 27, 2024

For example when doing

trurl 'http://example.org/%18' --json

Adapted and extended test cases to verify.

Fixes #262
Reported-by: Emanuele Torre

For example when doing

    trurl 'http://example.org/%18' --json

Adapted and extended test cases to verify.

Fixes #262
Reported-by: Emanuele Torre
@bagder bagder merged commit a12ed0f into master Aug 27, 2024
11 checks passed
@bagder bagder deleted the bagder/json-control-bytes branch August 27, 2024 09:01
@emanuele6
Copy link
Collaborator

@bagder
This patch fixed --json, but not -g {path}:

$ ./trurl 'http://example.org/%18' -g '{path}'
trurl note: URL decode error, most likely because of rubbish in the input (path)

@bagder
Copy link
Member Author

bagder commented Aug 27, 2024

Correct, as I like to focus on one thing per issue but also that the "regular" output is different and might need other considerations. Should we really allow control codes to be output like this?

@emanuele6
Copy link
Collaborator

Correct, as I like to focus on one thing per issue

I mentioned it because this PR closed #262

Should we really allow control codes to be output like this?

I don't see why not, also note that this is only causing errors for non-query: gets:

$ trurl -g '{fragment}' 'https://example.org/compiler#def%20main:%20%0a%09print%20"hello"'
trurl note: URL decode error, most likely because of rubbish in the input (fragment)

$ trurl -g '{query:code}' 'https://example.org/compiler?code=def%20main:%0a%09print%20"hello"'                                                
def main:
	print "hello"

Incidentally, unrelated, but I have noticed that -g {query:blah} doesn't convert +=>

$ trurl -g '{query:code}' 'https://example.org/compiler?code=def+main:%0a%09print+"hello"'
def+main:
	print+"hello"

@bagder
Copy link
Member Author

bagder commented Aug 27, 2024

Incidentally, unrelated, but I have noticed that -g {query:blah} doesn't convert +=>

It does now! 😁

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.

Components with control characters don't appear in --json output, and non-urlencoded --get fails
2 participants