mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: support for underscores in URLs (when using S3 storage)
This commit is contained in:
parent
a8a0be0b34
commit
7244266174
4 changed files with 17 additions and 1 deletions
4
Gemfile
4
Gemfile
|
@ -249,6 +249,10 @@ gem 'stringex', require: false
|
|||
|
||||
gem 'logster'
|
||||
|
||||
# we need that to support underscore in URLs (mostly when using S3 for storing files)
|
||||
# cf. http://stackoverflow.com/a/17108137/11983
|
||||
gem 'addressable'
|
||||
|
||||
# perftools only works on 1.9 atm
|
||||
group :profile do
|
||||
# travis refuses to install this, instead of fuffing, just avoid it for now
|
||||
|
|
|
@ -407,6 +407,7 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
actionpack-action_caching
|
||||
active_model_serializers (~> 0.8.0)
|
||||
addressable
|
||||
annotate
|
||||
barber
|
||||
better_errors
|
||||
|
|
|
@ -847,7 +847,7 @@ en:
|
|||
purge_inactive_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted."
|
||||
enable_s3_uploads: "Place uploads on Amazon S3 storage. IMPORTANT: requires valid S3 credentials (both access key id & secret access key)."
|
||||
s3_use_iam_profile: 'Use AWS EC2 IAM role to retrieve keys. NOTE: enabling will override "s3 access key id" and "s3 secret access key" settings.'
|
||||
s3_upload_bucket: "The Amazon S3 bucket name that files will be uploaded into. WARNING: must be lowercase, no periods."
|
||||
s3_upload_bucket: "The Amazon S3 bucket name that files will be uploaded into. WARNING: must be lowercase, no periods, no underscores."
|
||||
s3_access_key_id: "The Amazon S3 access key id that will be used to upload images."
|
||||
s3_secret_access_key: "The Amazon S3 secret access key that will be used to upload images."
|
||||
s3_region: "The Amazon S3 region name that will be used to upload images."
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
require "open-uri"
|
||||
require "addressable/uri"
|
||||
|
||||
class URI::Parser
|
||||
|
||||
# HACK to support underscores in URLs
|
||||
def split(url)
|
||||
a = Addressable::URI::parse(url)
|
||||
[a.scheme, a.userinfo, a.host, a.port, nil, a.path, nil, a.query, a.fragment]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class FileHelper
|
||||
|
||||
|
|
Loading…
Reference in a new issue