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

Not well-formed (invalid token): line 2, column 344955 #440

Closed
gotlium opened this issue Jan 26, 2015 · 4 comments
Closed

Not well-formed (invalid token): line 2, column 344955 #440

gotlium opened this issue Jan 26, 2015 · 4 comments
Labels
feature-request This issue requests a feature.

Comments

@gotlium
Copy link

gotlium commented Jan 26, 2015

2015-01-26 10:41:00,033 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/root/src/awscli/awscli/clidriver.py", line 197, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/root/src/awscli/awscli/clidriver.py", line 357, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/root/src/awscli/awscli/clidriver.py", line 492, in __call__
    self._operation_object, call_parameters, parsed_globals)
  File "/root/src/awscli/awscli/clidriver.py", line 594, in invoke
    parsed_globals)
  File "/root/src/awscli/awscli/clidriver.py", line 607, in _display_response
    formatter(operation, response)
  File "/root/src/awscli/awscli/formatter.py", line 58, in __call__
    response_data = response.build_full_result()
  File "/usr/local/lib/python2.7/dist-packages/botocore/paginate.py", line 215, in build_full_result
    for _, page in self:
  File "/usr/local/lib/python2.7/dist-packages/botocore/paginate.py", line 70, in __iter__
    response = self._make_request(current_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/botocore/paginate.py", line 390, in _make_request
    return self._operation.call(self._endpoint, **current_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/botocore/operation.py", line 90, in call
    response = endpoint.make_request(self.model, request_dict)
  File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 110, in make_request
    return self._send_request(prepared_request, operation_model)
  File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 171, in _send_request
    request, operation_model, attempts)
  File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 204, in _get_response
    operation_model.output_shape)),
  File "/usr/local/lib/python2.7/dist-packages/botocore/parsers.py", line 210, in parse
    parsed = self._do_parse(response, shape)
  File "/usr/local/lib/python2.7/dist-packages/botocore/parsers.py", line 548, in _do_parse
    self._parse_payload(response, shape, member_shapes, final_parsed)
  File "/usr/local/lib/python2.7/dist-packages/botocore/parsers.py", line 581, in _parse_payload
    original_parsed = self._initial_body_parse(response['body'])
  File "/usr/local/lib/python2.7/dist-packages/botocore/parsers.py", line 655, in _initial_body_parse
    return self._parse_xml_string_to_dom(xml_string)
  File "/usr/local/lib/python2.7/dist-packages/botocore/parsers.py", line 337, in _parse_xml_string_to_dom
    parser.feed(xml_string)
ParseError: not well-formed (invalid token): line 2, column 344955
2015-01-26 10:41:00,033 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

not well-formed (invalid token): line 2, column 344955

this is a problem with uploaded file name

wpz1trtj.bmpҰഷ�㵰ഷ�&#xt
@jamesls
Copy link
Member

jamesls commented Jan 26, 2015

Can you show a sample code that demonstrates this issue?

@gotlium
Copy link
Author

gotlium commented Jan 26, 2015

aws s3api list-objects --region eu-west-1 --bucket backetname --output json --query "[sum(Contents[].Size), length(Contents[])]"

xml string(http://take.ms/sx8sw)

<Owner><ID>5d63b45b47d6889d1b24546db5b1e6f296ad67c639d8bdbe2a8eae8ac1fa5932</ID> 
<DisplayName>archik11</DisplayName></Owner><StorageClass>STANDARD</StorageClass>
</Contents>
<Contents><Key>images/119083/
wpz1trtj.bmpҰഷ�㵰ഷ�&#xt

after removing file from web all is ok
this file was uploaded by unknown user from our site

@jamesls jamesls added bug This issue is a confirmed bug. confirmed labels Feb 9, 2015
@jamesls
Copy link
Member

jamesls commented Feb 9, 2015

Ah yes. This issue is because S3 returns an XML document that our XML parser in python cannot parse. The fix for this is to use an --encoding-type "url" which will urlencode the key names, and then to urldecode the keys on the response. We do this automatically for the high level s3 cp/mv/sync commands, but we don't do this for the low level s3api list-objects command. I think we should just add a customization in the ListObjects operation to always apply this option and urldecode the keys before returning to the customer.

@jamesls jamesls added feature-request This issue requests a feature. and removed bug This issue is a confirmed bug. labels Jun 12, 2015
@JordonPhillips
Copy link
Contributor

We automatically set this encoding if it isn't provided as of #726

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue requests a feature.
Projects
None yet
Development

No branches or pull requests

3 participants