Skip to content

Deprecate ActiveStorage::Service::AzureStorageService #52863

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

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions activestorage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Deprecate `ActiveStorage::Service::AzureStorageService`.

*zzak*

* Improve `ActiveStorage::Filename#sanitized` method to handle special characters more effectively.
Replace the characters `"*?<>` with `-` if they exist in the Filename to match the Filename convention of Win OS.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ class Service::AzureStorageService < Service
attr_reader :client, :container, :signer

def initialize(storage_account_name:, storage_access_key:, container:, public: false, **options)
ActiveStorage.deprecator.warn <<~MSG.squish
`ActiveStorage::Service::AzureStorageService` is deprecated and will be
removed in Rails 8.1.
Please try the `azure-blob` gem instead.
This gem is not maintained by the Rails team, so please test your applications before deploying to production.
MSG

@client = Azure::Storage::Blob::BlobService.create(storage_account_name: storage_account_name, storage_access_key: storage_access_key, **options)
@signer = Azure::Storage::Common::Core::Auth::SharedAccessSignature.new(storage_account_name, storage_access_key)
@container = container
Expand Down
18 changes: 18 additions & 0 deletions activestorage/test/service/configurator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,22 @@ class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
ActiveStorage::Service::Configurator.build(:bigfoot, {})
end
end

test "azure service is deprecated" do
msg = <<~MSG.squish
`ActiveStorage::Service::AzureStorageService` is deprecated and will be
removed in Rails 8.1.
Please try the `azure-blob` gem instead.
This gem is not maintained by the Rails team, so please test your applications before deploying to production.
MSG

assert_deprecated(msg, ActiveStorage.deprecator) do
ActiveStorage::Service::Configurator.build(:azure, azure: {
service: "AzureStorage",
storage_account_name: "test_account",
storage_access_key: Base64.encode64("test_access_key").strip,
container: "container"
})
end
end
end