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

Storage - listAllWithCompletion calls the completion helper twice if an error occured #7197

Closed
TPXP opened this issue Dec 18, 2020 · 1 comment · Fixed by #7199
Closed

Storage - listAllWithCompletion calls the completion helper twice if an error occured #7197

TPXP opened this issue Dec 18, 2020 · 1 comment · Fixed by #7199
Assignees
Milestone

Comments

@TPXP
Copy link

TPXP commented Dec 18, 2020

Step 0: Are you in the right place?

  • For issues or feature requests related to the code in this repository
    file a Github issue.
    • If this is a feature request please use the Feature Request template.
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general (non-iOS) Firebase discussion, use the firebase-talk
    google group.
  • For backend issues, console issues, and other non-SDK help that does not fall under one
    of the above categories, reach out to
    Firebase Support.
  • Once you've read this section and determined that your issue is appropriate for
    this repository, please delete this section.

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 12.3
  • Firebase SDK version: 7.2.0
  • Installation method: CocoaPods
  • Firebase Component: Storage

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

  • Create a ref for a cloud storage folder the current user cannot list items.
  • Call listAllWithCompletion on this StorageRef
  • Notice the completion helper is called twice: once with the permission denied error, the other time with an empty directory result.

Relevant Code:

Sorry, I suck at ObjC, here's a reproduction with the RNFirebase SDK invertase/react-native-firebase#4688

This issue can be summed up in one question: Is there a missing return here:

... Or did you intend to call the completion helper with the files you got so far if an error occurs?

Since this seems to differ with the behaviour on Android (where the Task class will not allow you to reject and resolve the same task, I think?), I think adding a warning in the documentation could help anyway.

@paulb777
Copy link
Member

@TPXP Thanks for the thorough report and analysis. I believe that your assumption is correct and a return should be added after the callback. We'll confirm with the Storage team and, if so, make the fix.

@paulb777 paulb777 self-assigned this Dec 21, 2020
@paulb777 paulb777 added this to the 7.4.0 - M87 milestone Dec 21, 2020
@firebase firebase locked and limited conversation to collaborators Jan 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants