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

GoogleJSON directories#get does not accept a prefix option #296

Closed
tcdowney opened this issue Jan 24, 2018 · 9 comments · Fixed by #299
Closed

GoogleJSON directories#get does not accept a prefix option #296

tcdowney opened this issue Jan 24, 2018 · 9 comments · Fixed by #299
Assignees

Comments

@tcdowney
Copy link
Contributor

In the older GoogleXML implementation you could pass this call a prefix option that would only fetch objects in the bucket that began with that prefix.

For example, this would only return objects directly under the 06824f8f-d185-409f-be75-55dba0a9a904 directory:

prefix = ' buildpack_cache/06/82/06824f8f-d185-409f-be75-55dba0a9a904'
connection.directories.get(dir.key, prefix: prefix).files

The newer API implementation no longer accepts prefix.

Is there a way that support for the prefix option could be maintained?

Thanks!
Tim Downey && @maryamklabib

@icco
Copy link
Member

icco commented Jan 25, 2018

I think the fact that worked before is a bug in the xml code. I would expect the call to be

connection.directories.get(dir.key).files(prefix: prefix)

For example the list call for files supports prefix in both APIs: https://cloud.google.com/storage/docs/json_api/v1/objects/list and https://cloud.google.com/storage/docs/xml-api/get-bucket-list

@icco icco self-assigned this Jan 25, 2018
@tcdowney
Copy link
Contributor Author

Hmm that's interesting. We'll test out calling it that way with fog-aws as well. Thanks!

@icco
Copy link
Member

icco commented Jan 25, 2018

👍

@icco icco closed this as completed Jan 25, 2018
@tcdowney
Copy link
Contributor Author

@icco

It actually looks like we can't pass any arguments to directory#files. When we do we're getting an ArgumentError wrong number of arguments (given 1, expected 0) here:

/stuff/fog-google-8beb64921385/lib/fog/storage/google_json/model
s/directory.rb:40:in `files'

def files
@files ||= begin
Fog::Storage::GoogleJSON::Files.new(
:directory => self,
:service => service
)
end
end

The fog-aws implementation also doesn't support calling it this way.

@erjohnso erjohnso reopened this Jan 29, 2018
@anniesing
Copy link

Thanks for re-opening the issue @erjohnso. Let us know if you need any other information that will help with debugging this issue. @elenasharma and I are taking this over from @tcdowney, so feel free to tag us directly as well.

Thanks,
Annie and Elena

@icco
Copy link
Member

icco commented Jan 31, 2018

@anniesing I've merged in @emilymye's PR with a fix, please give it a try.

@maryamklabib
Copy link

@icco Thank you, everything seems to work great now. When will the next release be cut?

@icco
Copy link
Member

icco commented Feb 1, 2018

I'll cut now, was just waiting for someone to verify :D

@erjohnso
Copy link
Contributor

erjohnso commented Feb 1, 2018

@icco 👏 👏 👏 👏 👏

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 a pull request may close this issue.

5 participants