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

Blank URL should not exist as an S3Object #43

Open
mig-hub opened this issue Nov 2, 2011 · 1 comment
Open

Blank URL should not exist as an S3Object #43

mig-hub opened this issue Nov 2, 2011 · 1 comment

Comments

@mig-hub
Copy link

mig-hub commented Nov 2, 2011

Hello,

I think this is personal taste so I would not count this as an issue, but here is my doubt:

AWS::S3::S3Object.exists?( "", "mybucket")

I don't think this should return true because there is no S3Object.
I understand the logic behind it as the URL exists, this is the address of the bucket itself.
But in the way it is accessed here, it does not make much sense.
Especially when the find method raises an error:

AWS::S3::S3Object.find( "", "mybucket")   #=> NoMethodError: undefined method `-' for nil:NilClass

At least both should be consistent in terms of failure-or-not.
Also I understand that looking for a blank filename is stupid, but it makes sense if the name is generated.
I personally encountered this while building some tests/specs.

My test was originally having nil as a filename and it raises an error so I thought I could just pass it through Nil#to_s and that is when I had my test failing while it was imho correct.

What do you guys think about that?
I'm looking forward to hearing your opinion.

Thank you for reading
Mig

@mig-hub
Copy link
Author

mig-hub commented Nov 2, 2011

In fact I expected a behaviour similar to:

AWS::S3::Bucket.objects('mybucket').map{|o|o.key}.member?( "" )

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