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

key.size only correct after reading #53

Closed
gataky opened this issue Oct 25, 2013 · 2 comments
Closed

key.size only correct after reading #53

gataky opened this issue Oct 25, 2013 · 2 comments

Comments

@gataky
Copy link
Contributor

gataky commented Oct 25, 2013

When getting the size of a key that was just fetched from a bucket, the size reports 0 until, as far as I can tell, read the keys data then size will report correctly. Example below.

boto==2.14.0

    b = conn.get_bucket("mybucket")
    k = b.get_key("steve")

    assert k.size == 0
    k.get_contents_as_string()
    assert k.size == 10
@gataky
Copy link
Contributor Author

gataky commented Oct 25, 2013

Doing a little digging I see that when we're trying to get_key, we're using a HEAD which is what the boto docs say it does. But they're returning a key object and moto's returning "". Changing "" to key.value in moto/s3/responses.py line 167 appears to fix this problem. I ran the test's and they all passed after the change. Hope this helps.

@spulec
Copy link
Collaborator

spulec commented Nov 8, 2013

This was closed with #54.

@spulec spulec closed this as completed Nov 8, 2013
bblommers added a commit to usmangani1/moto that referenced this issue Jul 31, 2020
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