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
637017c1
Commit
637017c1
authored
Nov 02, 2020
by
George Koltsov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore Errno::ENAMETOOLONG exception when exporting project uploads
parent
5bdd3c1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
changelogs/unreleased/georgekoltsov-ignore-failed-to-download-project-export-uploads.yml
...tsov-ignore-failed-to-download-project-export-uploads.yml
+6
-0
lib/gitlab/import_export/uploads_manager.rb
lib/gitlab/import_export/uploads_manager.rb
+4
-0
spec/lib/gitlab/import_export/uploads_manager_spec.rb
spec/lib/gitlab/import_export/uploads_manager_spec.rb
+20
-4
No files found.
changelogs/unreleased/georgekoltsov-ignore-failed-to-download-project-export-uploads.yml
0 → 100644
View file @
637017c1
---
title
:
Fix 'File name too long' error happening during Project Export when exporting
project uploads
merge_request
:
46674
author
:
type
:
fixed
lib/gitlab/import_export/uploads_manager.rb
View file @
637017c1
...
@@ -86,6 +86,10 @@ module Gitlab
...
@@ -86,6 +86,10 @@ module Gitlab
mkdir_p
(
File
.
join
(
uploads_export_path
,
secret
))
mkdir_p
(
File
.
join
(
uploads_export_path
,
secret
))
download_or_copy_upload
(
upload
,
upload_path
)
download_or_copy_upload
(
upload
,
upload_path
)
rescue
Errno
::
ENAMETOOLONG
=>
e
# Do not fail entire project export if downloaded file has filename that exceeds 255 characters.
# Ignore raised exception, skip such upload, log the error and keep going with the export instead.
Gitlab
::
ErrorTracking
.
log_exception
(
e
,
project_id:
@project
.
id
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/import_export/uploads_manager_spec.rb
View file @
637017c1
...
@@ -23,13 +23,13 @@ RSpec.describe Gitlab::ImportExport::UploadsManager do
...
@@ -23,13 +23,13 @@ RSpec.describe Gitlab::ImportExport::UploadsManager do
end
end
describe
'#save'
do
describe
'#save'
do
before
do
project
.
uploads
<<
upload
end
context
'when the project has uploads locally stored'
do
context
'when the project has uploads locally stored'
do
let
(
:upload
)
{
create
(
:upload
,
:issuable_upload
,
:with_file
,
model:
project
)
}
let
(
:upload
)
{
create
(
:upload
,
:issuable_upload
,
:with_file
,
model:
project
)
}
before
do
project
.
uploads
<<
upload
end
it
'does not cause errors'
do
it
'does not cause errors'
do
manager
.
save
manager
.
save
...
@@ -74,6 +74,22 @@ RSpec.describe Gitlab::ImportExport::UploadsManager do
...
@@ -74,6 +74,22 @@ RSpec.describe Gitlab::ImportExport::UploadsManager do
end
end
end
end
end
end
context
'when upload is in object storage'
do
before
do
stub_uploads_object_storage
(
FileUploader
)
allow
(
manager
).
to
receive
(
:download_or_copy_upload
).
and_raise
(
Errno
::
ENAMETOOLONG
)
end
it
'ignores problematic upload and logs exception'
do
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:log_exception
).
with
(
instance_of
(
Errno
::
ENAMETOOLONG
),
project_id:
project
.
id
)
manager
.
save
expect
(
shared
.
errors
).
to
be_empty
expect
(
File
).
not_to
exist
(
exported_file_path
)
end
end
end
end
describe
'#restore'
do
describe
'#restore'
do
...
...
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