Skip to content

@tus/azure-store: Cannot download file #791

@osarogie

Description

@osarogie

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @tus/[email protected] for the project I'm working on.

Steps to reproduce:

  1. Uploading a file to azure blob store.
  2. Navigate to uploaded file url provided by the Tus Server.
  3. Request fails with 500 error and message "Metadata string is not valid".

Here is the diff that solved my problem:

diff --git a/node_modules/@tus/azure-store/dist/index.js b/node_modules/@tus/azure-store/dist/index.js
index 77efab1..1ad25c9 100644
--- a/node_modules/@tus/azure-store/dist/index.js
+++ b/node_modules/@tus/azure-store/dist/index.js
@@ -71,7 +71,7 @@ export class AzureStore extends DataStore {
         const upload = JSON.parse(propertyData.metadata.upload);
         // Metadata is base64 encoded to avoid errors for non-ASCII characters
         // so we need to decode it separately
-        upload.metadata = Metadata.parse(JSON.stringify(upload.metadata ?? {}));
+        upload.metadata = upload.metadata ? Metadata.parse(upload.metadata) : {};
         await this.cache.set(appendBlobClient.url, upload);
         log('metadata returned from blob get properties');
         return upload;

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions