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
39b489ba
Unverified
Commit
39b489ba
authored
2 years ago
by
Holger
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: `s3_force_single_request` not parsed (#17922)
parent
44b7be45
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/application.rb
+0
-1
0 additions, 1 deletion
config/application.rb
config/initializers/paperclip.rb
+20
-0
20 additions, 0 deletions
config/initializers/paperclip.rb
lib/paperclip/storage_extensions.rb
+0
-21
0 additions, 21 deletions
lib/paperclip/storage_extensions.rb
with
20 additions
and
22 deletions
config/application.rb
+
0
−
1
View file @
39b489ba
...
@@ -27,7 +27,6 @@ require_relative '../lib/sanitize_ext/sanitize_config'
...
@@ -27,7 +27,6 @@ require_relative '../lib/sanitize_ext/sanitize_config'
require_relative
'../lib/redis/namespace_extensions'
require_relative
'../lib/redis/namespace_extensions'
require_relative
'../lib/paperclip/url_generator_extensions'
require_relative
'../lib/paperclip/url_generator_extensions'
require_relative
'../lib/paperclip/attachment_extensions'
require_relative
'../lib/paperclip/attachment_extensions'
require_relative
'../lib/paperclip/storage_extensions'
require_relative
'../lib/paperclip/lazy_thumbnail'
require_relative
'../lib/paperclip/lazy_thumbnail'
require_relative
'../lib/paperclip/gif_transcoder'
require_relative
'../lib/paperclip/gif_transcoder'
require_relative
'../lib/paperclip/transcoder'
require_relative
'../lib/paperclip/transcoder'
...
...
This diff is collapsed.
Click to expand it.
config/initializers/paperclip.rb
+
20
−
0
View file @
39b489ba
...
@@ -83,6 +83,26 @@ if ENV['S3_ENABLED'] == 'true'
...
@@ -83,6 +83,26 @@ if ENV['S3_ENABLED'] == 'true'
s3_host_alias:
ENV
[
'S3_ALIAS_HOST'
]
||
ENV
[
'S3_CLOUDFRONT_HOST'
]
s3_host_alias:
ENV
[
'S3_ALIAS_HOST'
]
||
ENV
[
'S3_CLOUDFRONT_HOST'
]
)
)
end
end
# 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_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
elsif
ENV
[
'SWIFT_ENABLED'
]
==
'true'
elsif
ENV
[
'SWIFT_ENABLED'
]
==
'true'
require
'fog/openstack'
require
'fog/openstack'
...
...
This diff is collapsed.
Click to expand it.
lib/paperclip/storage_extensions.rb
deleted
100644 → 0
+
0
−
21
View file @
44b7be45
# 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