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

Abort if the response is not well-formed XML #108

Open
BrucePerens opened this issue Aug 19, 2022 · 1 comment
Open

Abort if the response is not well-formed XML #108

BrucePerens opened this issue Aug 19, 2022 · 1 comment

Comments

@BrucePerens
Copy link

BrucePerens commented Aug 19, 2022

@node.root.not_nil!.namespaces

aborts in not_nil! if the response is not well-formed XML.

Unhandled exception: Nil assertion failed (NilAssertionError)
  from /usr/share/crystal/src/nil.cr:108:5 in 'not_nil!'
  from lib/awscr-s3/src/awscr-s3/xml.cr:48:9 in 'namespaces'
  from lib/awscr-s3/src/awscr-s3/xml.cr:39:12 in 'namespace'
  from lib/awscr-s3/src/awscr-s3/xml.cr:29:14 in 'build_path'
  from lib/awscr-s3/src/awscr-s3/xml.cr:11:21 in 'string'
  from lib/awscr-s3/src/awscr-s3/xml.cr:53:33 in 'Awscr::S3::XML#string<String>:String'
  from lib/awscr-s3/src/awscr-s3/exceptions.cr:88:7 in 'from_response'
  from lib/awscr-s3/src/awscr-s3/http.cr:114:9 in 'handle_response!'
  from lib/awscr-s3/src/awscr-s3/http.cr:88:16 in 'exec'
  from lib/awscr-s3/src/awscr-s3/http.cr:46:7 in 'put'
  from lib/awscr-s3/src/awscr-s3/client.cr:243:7 in 'put_object'
  from lib/awscr-s3/src/awscr-s3/file_uploader.cr:34:9 in 'upload'
@BrucePerens
Copy link
Author

And how did I get there? It's this bug: crystal-lang/crystal#11354
The response body starts with the gzip magic number.
But in any case awscr-s3 should be robust against poorly-formatted responses.

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