Sha256: 1783c620c5b838295dc1ddda5ae801ec0086d91fa7a49fe59ffc319eefd1ac05
Contents?: true
Size: 1.95 KB
Versions: 4
Compression:
Stored size: 1.95 KB
Contents
# This software code is made available "AS IS" without warranties of any # kind. You may copy, display, modify and redistribute the software # code either by itself or as incorporated into your code; provided that # you do not remove any proprietary notices. Your use of this software # code is at your own risk and you waive any claim against the author # with respect to your use of this software code. # (c) 2007 s3sync.net # # The purpose of this file is to overlay the cgi class # to add some functionality # (without changing the file itself or requiring a specific version) # It still isn't perfectly robust, i.e. if radical changes are made # to the underlying lib this stuff will need updating. require 'cgi' ##require 'iconv' # for UTF-8 conversion # thanks to http://www.redhillconsulting.com.au/blogs/simon/archives/000326.html module S3ExtendCGI def self.included(base) base.extend(ClassMethods) base.class_eval do class << self alias_method :S3Extend_escape_orig, :escape unless method_defined?(:S3Extend_escape_orig) alias_method :escape, :S3Extend_escape end end end module ClassMethods @@exemptSlashesInEscape = false attr_writer :exemptSlashesInEscape @@usePercent20InEscape = false attr_writer :usePercent20InEscape @@nativeCharacterEncoding = "ISO-8859-1" attr_writer :nativeCharacterEncoding @@useUTF8InEscape = false attr_writer :useUTF8InEscape def S3Extend_escape(string) result = string result = string.encode(@nativeCharacterEncoding, :invalid => :replace, :undef => :replace, :replace => "") if @useUTF8InEscape #result = Iconv.iconv("UTF-8", @nativeCharacterEncoding, string).join if @useUTF8InEscape result = S3Extend_escape_orig(result) result.gsub!(/%2f/i, "/") if @exemptSlashesInEscape result.gsub!("+", "%20") if @usePercent20InEscape result end end end CGI.send(:include, S3ExtendCGI)
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cprobert-s3sync-1.4.4 | lib/s3sync/S3encoder.rb |
cprobert-s3sync-1.4.2 | lib/s3sync/S3encoder.rb |
cprobert-s3sync-1.4.1 | lib/s3sync/S3encoder.rb |
cprobert-s3sync-1.3.9 | lib/s3sync/S3encoder.rb |