Cannot reference files in Object Storage that contains characters in its name that are not in the ASCII code

Summary

While using the Azure Blob Storage service for GitLab data storage,
If you upload a file with a name that contains characters that are not in the ASCII code,
you can't browse the file through GitLab's web UI.

Steps to reproduce

  1. Enable Object Storage (Azure Blob Storage) and configure uploads to be stored in Azure Blob Storage.
    https://docs.gitlab.com/ee/administration/object_storage.html#consolidated-object-storage-configuration
    https://docs.gitlab.com/ee/administration/object_storage.html#azure-blob-storage
...
gitlab_rails['object_store']['enabled'] = true
gitlab_rails['object_store']['connection'] = {
   'provider' => 'AzureRM',
   'azure_storage_account_name' => 'xxxxx...',
   'azure_storage_access_key' => 'xxxxx...',
   'azure_storage_domain' => 'blob.core.windows.net'
}
gitlab_rails['object_store']['objects']['uploads']['bucket'] = 'uploads'
...
  1. Create an Issue and upload a file with a name that contains characters that are not in the ASCII code (eg テスト.jpg).

  2. Access the upload file link on the Issue.

  3. return 500 error.

What is the current bug behavior?

The uploaded file is stored in Azure Blob Storage.
However, when GitLab creates a link to a file that can be accessed through the web UI,
you get URI::InvalidURIError.
https://gitlab.com/gitlab-org/gitlab-foss/-/blob/13-5-stable/config/initializers/carrierwave_patch.rb#L28-49

Completed 500 Internal Server Error in 264ms (ActiveRecord: 16.8ms | Elasticsearch: 0.0ms | Allocations: 46175)
URI must be ascii only "https://xxx.blob.core.windows.net/uploads/..."
URI::InvalidURIError (URI must be ascii only "https://xxx.blob.core.windows.net/uploads/...)

What is the expected correct behavior?

You can access the file through the web UI.

Possible fixes

It is necessary to encode the path with URI.encode(path).
https://gitlab.com/gitlab-org/gitlab-foss/-/blob/13-5-stable/config/initializers/carrierwave_patch.rb#L32
However, the path must be decoded when getting the link.
https://github.com/Azure/azure-storage-ruby/blob/v2.0.1-file/common/lib/azure/storage/common/core/auth/shared_access_signature_generator.rb#L212

Edited by tsato1222