platformOS Community

upload_url encoded twice in graphql admin_assets_presign_url

tommyooc Oct 01 2021 at 13:03

Hello,

I just tried to get presign url using admin_assets_presign_url, and the path contains white space.

mutation get_assets_presign_url {
  mutation: admin_assets_presign_urls(
    paths: {
      path: "modules/admin/file white white space.jpg"
    }
  ) {
    urls {
      path
      upload_url
      access_url
    }
  }
}

And this is the results

{
  "data": {
    "mutation": {
      "urls": [
        {
          "path": "modules/admin/file%20white%20white%20space.jpg",
          "upload_url": "https://s3.us-west-2.amazonaws.com/uploads.staging.oregon.platform-os.com/instances/6455/assets/modules/admin/file%2520white%2520white%2520space.jpg?[...]",
          "access_url": "https://uploads.staging.oregon.platform-os.com/instances/6455/assets/modules/admin/file%20white%20white%20space.jpg"
        }
      ]
    }
  }
}

As we can see, the white space in upload_url is encoded twice %2520... but not in access_url.

So we will not be able to register assets using the access_url, because it will give an access denied error message.

How I can fix the issue?

Please sign in or fill up your profile to answer a question