class ActiveStorage::Service::DiskService

def generate_url(key, expires_in:, filename:, content_type:, disposition:)

def generate_url(key, expires_in:, filename:, content_type:, disposition:)
  content_disposition = content_disposition_with(type: disposition, filename: filename)
  verified_key_with_expiration = ActiveStorage.verifier.generate(
    {
      key: key,
      disposition: content_disposition,
      content_type: content_type,
      service_name: name
    },
    expires_in: expires_in,
    purpose: :blob_key
  )
  if url_options.blank?
    raise ArgumentError, "Cannot generate URL for #{filename} using Disk service, please set ActiveStorage::Current.url_options."
  end
  url_helpers.rails_disk_service_url(verified_key_with_expiration, filename: filename, **url_options)
end