Improve message for upload request to LFS batch URL on secondary node

parent d2b1cf63
class Projects::LfsApiController < Projects::GitHttpClientController
include ApplicationSettingsHelper
include ApplicationHelper
include GitlabRoutingHelper
include LfsRequest
skip_before_action :lfs_check_access!, only: [:deprecated]
......@@ -96,7 +99,7 @@ class Projects::LfsApiController < Projects::GitHttpClientController
if upload_request? && Gitlab::Geo.secondary?
render(
json: {
message: 'You cannot do writing operations on a secondary GitLab Geo instance.'
message: "You cannot write to a secondary GitLab Geo instance. Please use #{geo_primary_default_url_to_repo(project)} instead."
},
content_type: "application/vnd.git-lfs+json",
status: 403
......
......@@ -861,6 +861,7 @@ describe 'Git LFS API and storage' do
end
describe 'when handling lfs batch request on a secondary Geo node' do
let!(:primary) { create(:geo_node, :primary) }
let(:authorization) { authorize_user }
let(:project) { create(:project) }
let(:path) { "#{project.http_url_to_repo}/info/lfs/objects/batch" }
......@@ -889,7 +890,7 @@ describe 'Git LFS API and storage' do
post_lfs_json path, body.merge('operation' => 'upload'), headers
expect(response).to have_http_status(403)
expect(json_response).to include('message' => 'You cannot do writing operations on a secondary GitLab Geo instance.')
expect(json_response).to include('message' => "You cannot write to a secondary GitLab Geo instance. Please use #{project.http_url_to_repo} instead.")
end
end
......
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