Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
6ba8bc45
Unverified
Commit
6ba8bc45
authored
3 years ago
by
Claire
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add S3_FORCE_SINGLE_REQUEST env var to work around S3 compatibility issues (#16866)
Fixes #16822
parent
9cdf8ac1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/application.rb
+1
-0
1 addition, 0 deletions
config/application.rb
lib/paperclip/storage_extensions.rb
+21
-0
21 additions, 0 deletions
lib/paperclip/storage_extensions.rb
with
22 additions
and
0 deletions
config/application.rb
+
1
−
0
View file @
6ba8bc45
...
...
@@ -27,6 +27,7 @@ require_relative '../lib/sanitize_ext/sanitize_config'
require_relative
'../lib/redis/namespace_extensions'
require_relative
'../lib/paperclip/url_generator_extensions'
require_relative
'../lib/paperclip/attachment_extensions'
require_relative
'../lib/paperclip/storage_extensions'
require_relative
'../lib/paperclip/lazy_thumbnail'
require_relative
'../lib/paperclip/gif_transcoder'
require_relative
'../lib/paperclip/transcoder'
...
...
This diff is collapsed.
Click to expand it.
lib/paperclip/storage_extensions.rb
0 → 100644
+
21
−
0
View file @
6ba8bc45
# frozen_string_literal: true
# Some S3-compatible providers might not actually be compatible with some APIs
# used by kt-paperclip, see https://github.com/mastodon/mastodon/issues/16822
if
ENV
[
'S3_ENABLED'
]
==
'true'
&&
ENV
[
'S3_FORCE_SINGLE_REQUEST'
]
==
'true'
module
Paperclip
module
Storage
module
S3Extensions
def
copy_to_local_file
(
style
,
local_dest_path
)
log
(
"copying
#{
path
(
style
)
}
to local file
#{
local_dest_path
}
"
)
s3_object
(
style
).
download_file
(
local_dest_path
,
{
mode:
'single_request'
})
rescue
Aws
::
Errors
::
ServiceError
=>
e
warn
(
"
#{
e
}
- cannot copy
#{
path
(
style
)
}
to local file
#{
local_dest_path
}
"
)
false
end
end
end
end
Paperclip
::
Storage
::
S3
.
prepend
(
Paperclip
::
Storage
::
S3Extensions
)
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment