Commit 64ae30b5 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '218557-geo-design-thumbnails-are-not-replicated' into 'master'

Resolve "Geo: Design thumbnails are not replicated"

Closes #218557

See merge request gitlab-org/gitlab!32703
parents 355eab26 3d5fa07f
---
title: Fix Geo replication for design thumbnails
merge_request: 32703
author:
type: fixed
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module Geo module Geo
module Replication module Replication
USER_UPLOADS_OBJECT_TYPES = %i[attachment avatar file import_export namespace_file personal_file favicon].freeze USER_UPLOADS_OBJECT_TYPES = %i[attachment avatar file import_export namespace_file personal_file favicon design_management/design_v432x230].freeze
FILE_NOT_FOUND_GEO_CODE = 'FILE_NOT_FOUND'.freeze FILE_NOT_FOUND_GEO_CODE = 'FILE_NOT_FOUND'.freeze
def self.object_type_from_user_uploads?(object_type) def self.object_type_from_user_uploads?(object_type)
......
...@@ -46,7 +46,7 @@ module Gitlab ...@@ -46,7 +46,7 @@ module Gitlab
# @return [String] URL to download the resource from # @return [String] URL to download the resource from
def resource_url def resource_url
Gitlab::Geo.primary_node.geo_transfers_url(file_type, file_id.to_s) Gitlab::Geo.primary_node.geo_transfers_url(url_encode(file_type), file_id.to_s)
end end
# Returns Result object with success boolean and number of bytes downloaded. # Returns Result object with success boolean and number of bytes downloaded.
......
...@@ -8,6 +8,20 @@ describe Gitlab::Geo::Replication::BaseTransfer do ...@@ -8,6 +8,20 @@ describe Gitlab::Geo::Replication::BaseTransfer do
let_it_be(:primary_node) { create(:geo_node, :primary) } let_it_be(:primary_node) { create(:geo_node, :primary) }
let_it_be(:secondary_node) { create(:geo_node) } let_it_be(:secondary_node) { create(:geo_node) }
describe '#resource_url' do
subject do
described_class.new(file_type: 'design_management/design_v432x230', file_id: 1,
filename: Tempfile.new, expected_checksum: nil, request_data: nil)
end
context 'when file type contains /' do
it 'returns escaped url' do
url = subject.resource_url
expect(url).to include('design_management%2Fdesign_v432x230')
end
end
end
describe '#can_transfer?' do describe '#can_transfer?' do
subject do subject do
described_class.new(file_type: :avatar, file_id: 1, filename: Tempfile.new, described_class.new(file_type: :avatar, file_id: 1, filename: Tempfile.new,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment