Sha256: 98b67beb14ad010a6e4d2f6837d2b1f60fa1280e035817c7230cd70ed2e65a81
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 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' # 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("UTF-8", @nativeCharacterEncoding) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
frahugo-s3sync-1.4.1 | lib/s3sync/S3encoder.rb |