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
a3048ec8
Commit
a3048ec8
authored
Oct 08, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Geo transfers failure handling when filename too long
Improves existing log information as well. Closes #3682
parent
ab3e684f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
lib/gitlab/geo/transfer.rb
lib/gitlab/geo/transfer.rb
+4
-3
spec/lib/gitlab/geo/transfer_spec.rb
spec/lib/gitlab/geo/transfer_spec.rb
+6
-0
No files found.
lib/gitlab/geo/transfer.rb
View file @
a3048ec8
...
...
@@ -70,7 +70,7 @@ module Gitlab
temp_file
.
flush
unless
response
.
success?
log_error
(
"Unsuccessful download"
,
response_code:
response
.
code
,
response_msg:
response
.
msg
)
log_error
(
"Unsuccessful download"
,
filename:
filename
,
response_code:
response
.
code
,
response_msg:
response
.
msg
)
return
file_size
end
...
...
@@ -84,7 +84,7 @@ module Gitlab
file_size
=
File
.
stat
(
filename
).
size
log_info
(
"Successful downloaded"
,
filename:
filename
,
file_size_bytes:
file_size
)
rescue
StandardError
,
HTTParty
::
Error
=>
e
log_error
(
"Error downloading file"
,
error:
e
)
log_error
(
"Error downloading file"
,
error:
e
,
filename:
filename
)
ensure
temp_file
.
close
temp_file
.
unlink
...
...
@@ -101,12 +101,13 @@ module Gitlab
begin
# Make sure the file is in the same directory to prevent moves across filesystems
pathname
=
Pathname
.
new
(
target_filename
)
temp
=
Tempfile
.
new
(
TEMP_PREFIX
+
pathname
.
basename
.
to_s
,
pathname
.
dirname
.
to_s
)
temp
=
Tempfile
.
new
(
TEMP_PREFIX
,
pathname
.
dirname
.
to_s
)
temp
.
chmod
(
default_permissions
)
temp
.
binmode
temp
rescue
StandardError
=>
e
log_error
(
"Error creating temporary file"
,
error:
e
)
nil
end
end
end
...
...
spec/lib/gitlab/geo/transfer_spec.rb
View file @
a3048ec8
...
...
@@ -47,5 +47,11 @@ describe Gitlab::Geo::Transfer do
expect
(
subject
.
download_from_primary
).
to
eq
(
-
1
)
end
it
'when Tempfile fails'
do
expect
(
Tempfile
).
to
receive
(
:new
).
and_raise
(
Errno
::
ENAMETOOLONG
)
expect
(
subject
.
download_from_primary
).
to
eq
(
nil
)
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