Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c3bf1e21
Commit
c3bf1e21
authored
Oct 04, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Fix attachments/avatars saving to the wrong directory
Closes #3634
parent
90f19538
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
changelogs/unreleased-ee/sh-fix-geo-file-transfers.yml
changelogs/unreleased-ee/sh-fix-geo-file-transfers.yml
+5
-0
lib/gitlab/geo/file_transfer.rb
lib/gitlab/geo/file_transfer.rb
+3
-1
spec/lib/gitlab/geo/file_transfer_spec.rb
spec/lib/gitlab/geo/file_transfer_spec.rb
+22
-0
No files found.
changelogs/unreleased-ee/sh-fix-geo-file-transfers.yml
0 → 100644
View file @
c3bf1e21
---
title
:
'
Geo:
Fix
attachments/avatars
saving
to
the
wrong
directory'
merge_request
:
author
:
type
:
fixed
lib/gitlab/geo/file_transfer.rb
View file @
c3bf1e21
...
...
@@ -2,9 +2,11 @@ module Gitlab
module
Geo
class
FileTransfer
<
Transfer
def
initialize
(
file_type
,
upload
)
uploader
=
upload
.
uploader
.
constantize
@file_type
=
file_type
@file_id
=
upload
.
id
@filename
=
upload
.
path
@filename
=
upload
er
.
absolute_path
(
upload
)
@request_data
=
build_request_data
(
upload
)
end
...
...
spec/lib/gitlab/geo/file_transfer_spec.rb
0 → 100644
View file @
c3bf1e21
require
'spec_helper'
describe
Gitlab
::
Geo
::
FileTransfer
do
let
(
:user
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
,
'image/png'
))
}
let
(
:upload
)
{
Upload
.
find_by
(
model:
user
,
uploader:
'AvatarUploader'
)
}
subject
{
described_class
.
new
(
:file
,
upload
)
}
describe
'#execute'
do
context
'user avatar'
do
it
'sets an absolute path'
do
expect
(
subject
.
file_type
).
to
eq
(
:file
)
expect
(
subject
.
file_id
).
to
eq
(
upload
.
id
)
expect
(
subject
.
filename
).
to
eq
(
AvatarUploader
.
absolute_path
(
upload
))
expect
(
Pathname
.
new
(
subject
.
filename
).
absolute?
).
to
be_truthy
expect
(
subject
.
request_data
).
to
eq
({
id:
upload
.
id
,
type:
'User'
,
checksum:
upload
.
checksum
})
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment