Skip to content

[Bug]  #1126

Closed
Closed
[Bug] #1126
@Elizeuvix

Description

@Elizeuvix

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 20.3.12f1
  • Firebase Unity SDK version: 8.1.0
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Storage
  • Other Firebase Components in use: Auth, Database
  • Additional SDKs you are using: nothing
  • Platform you are using the Unity editor on: Windows and/or Linux)
  • Platform you are targeting: desktop
  • Scripting Runtime: Mono C#

"There is a bug when downloading files from Firebase Storage. The downloaded file is corrupted. For example: A 20kb file when it is downloaded on my PC gets 1kb and no longer works."

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
What's the issue repro rate? 100%

What happened? How can we make the problem occur?
Use the Firebase Storage sample code to download a file that was previously uploaded to Firebase Storage. The downloaded file will be corrupted.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

public class Saving : MonoBehaviour
{
    private void DownloadStorageFile(){
        // Get a reference to the storage service, using the default Firebase App
        FirebaseStorage storage = FirebaseStorage.DefaultInstance;

        // Create a storage reference from our storage service
        storageRef =
            storage.GetReferenceFromUrl("gs://mybucket.appspot.com");

        // Set local file
        string local_file = "C:/Users/Public/TestFile.test";

        Task task = storageRef.GetFileAsync(local_file,
        new Firebase.Storage.StorageProgress <DownloadState>((DownloadState state) => {
            // called periodically during the download
            Debug.Log(String.Format("Progress: {0} of {1} bytes transferred.", 
                    state.BytesTransferred,
                    state.TotalByteCount));
            Debug.Log("Download Reference: "+state.Reference);
            }), CancellationToken.None);

            task.ContinueWith(resultTask => {
            if (!resultTask.IsFaulted && !resultTask.IsCanceled) {
                Debug.Log("Download finished.");
            }
        });
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions