utf8-cleaner 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +70 -0
- data/CHANGELOG.md +9 -1
- data/Gemfile +2 -1
- data/README.md +13 -19
- data/Rakefile +7 -4
- data/lib/utf8-cleaner/middleware.rb +41 -26
- data/lib/utf8-cleaner/railtie.rb +4 -2
- data/lib/utf8-cleaner/uri_string.rb +3 -2
- data/lib/utf8-cleaner/version.rb +3 -1
- data/lib/utf8-cleaner.rb +6 -4
- data/spec/middleware_spec.rb +4 -4
- data/spec/spec_helper.rb +2 -0
- data/spec/uri_string_spec.rb +6 -6
- data/utf8-cleaner.gemspec +15 -19
- metadata +16 -60
- data/.travis.yml +0 -7
- data/Guardfile +0 -9
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d7d130ec59597b9b6cb49ae8745fedf53d3cf10de189adef8240675193dc0f6c
         | 
| 4 | 
            +
              data.tar.gz: 929e15585f3104054786be08e51141f1732876d3e9d562ee9ff2d84817a36183
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f089a54246867ae6a438e68d45621e1ce56cfadd668a808079f46d8b9002650ceef35606e3a9cf49ca5a804fad8853db816963a31fc437c27e6d2cc974a9b741
         | 
| 7 | 
            +
              data.tar.gz: 911a4922eb376f1d59d5e9404b6bc427feb138f1872bcdac02a0e0d45d9426eee164cf65c31b779dba59a020516336875589fbe444031594509efc84fc6a718d
         | 
| @@ -0,0 +1,70 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            name: Test
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            'on':
         | 
| 5 | 
            +
              - push
         | 
| 6 | 
            +
              - pull_request
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            jobs:
         | 
| 9 | 
            +
              # rubocop:
         | 
| 10 | 
            +
              #   runs-on: ubuntu-latest
         | 
| 11 | 
            +
              #   env:
         | 
| 12 | 
            +
              #     CI: true
         | 
| 13 | 
            +
              #   steps:
         | 
| 14 | 
            +
              #     - uses: actions/checkout@v3
         | 
| 15 | 
            +
              #     - name: Set up Ruby 3.4
         | 
| 16 | 
            +
              #       uses: ruby/setup-ruby@v1
         | 
| 17 | 
            +
              #       with:
         | 
| 18 | 
            +
              #         ruby-version: 3.4
         | 
| 19 | 
            +
              #         bundler-cache: true
         | 
| 20 | 
            +
              #     - name: Run RuboCop
         | 
| 21 | 
            +
              #       run: bundle exec rubocop --parallel
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              test:
         | 
| 24 | 
            +
                name: "${{matrix.ruby}} ${{matrix.os || 'ubuntu-latest'}}"
         | 
| 25 | 
            +
                env:
         | 
| 26 | 
            +
                  CI: true
         | 
| 27 | 
            +
                runs-on: ${{matrix.os || 'ubuntu-latest'}}
         | 
| 28 | 
            +
                continue-on-error: "${{matrix.experimental || false}}"
         | 
| 29 | 
            +
                strategy:
         | 
| 30 | 
            +
                  fail-fast: false
         | 
| 31 | 
            +
                  matrix:
         | 
| 32 | 
            +
                    ruby:
         | 
| 33 | 
            +
                      - ruby-2.4
         | 
| 34 | 
            +
                      - ruby-2.5
         | 
| 35 | 
            +
                      - ruby-2.6
         | 
| 36 | 
            +
                      - ruby-2.7
         | 
| 37 | 
            +
                      - ruby-3.0
         | 
| 38 | 
            +
                      - ruby-3.1
         | 
| 39 | 
            +
                      - ruby-3.2
         | 
| 40 | 
            +
                      - ruby-3.3
         | 
| 41 | 
            +
                      - ruby-3.4
         | 
| 42 | 
            +
                      - jruby-9.4
         | 
| 43 | 
            +
                      - truffleruby
         | 
| 44 | 
            +
                    os:
         | 
| 45 | 
            +
                      - ubuntu-latest
         | 
| 46 | 
            +
                      - macos-latest
         | 
| 47 | 
            +
                      - windows-latest
         | 
| 48 | 
            +
                    exclude:
         | 
| 49 | 
            +
                      - ruby: ruby-2.4
         | 
| 50 | 
            +
                        os: macos-latest
         | 
| 51 | 
            +
                      - ruby: ruby-2.5
         | 
| 52 | 
            +
                        os: macos-latest
         | 
| 53 | 
            +
                      - ruby: jruby-9.4
         | 
| 54 | 
            +
                        os: windows-latest
         | 
| 55 | 
            +
                      - ruby: truffleruby
         | 
| 56 | 
            +
                        os: windows-latest
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                steps:
         | 
| 59 | 
            +
                  - name: repo checkout
         | 
| 60 | 
            +
                    uses: actions/checkout@v3
         | 
| 61 | 
            +
                  - name: load ruby
         | 
| 62 | 
            +
                    uses: ruby/setup-ruby@v1
         | 
| 63 | 
            +
                    with:
         | 
| 64 | 
            +
                      ruby-version: "${{matrix.ruby}}"
         | 
| 65 | 
            +
                  - name: bundle
         | 
| 66 | 
            +
                    run: bundle install --jobs 4 --retry 3
         | 
| 67 | 
            +
                  - name: test
         | 
| 68 | 
            +
                    timeout-minutes: 60
         | 
| 69 | 
            +
                    continue-on-error: "${{matrix.experimental || false}}"
         | 
| 70 | 
            +
                    run: bundle exec rake spec
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            # CHANGELOG
         | 
| 2 2 |  | 
| 3 | 
            +
            ## v2.0.0
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * Support Rack 3 and add Rack >= 3.0 as a dependency
         | 
| 6 | 
            +
            * Dropped support for Ruby < 2.4 to match Rack
         | 
| 7 | 
            +
            * Replace Travis CI with GitHub Actions
         | 
| 8 | 
            +
            * Add frozen_string_literal to all files
         | 
| 9 | 
            +
            * Remove guard gem
         | 
| 10 | 
            +
             | 
| 3 11 | 
             
            ## v1.0.0
         | 
| 4 12 |  | 
| 5 13 | 
             
            * Dropped support for Ruby < 2.3
         | 
| @@ -36,4 +44,4 @@ | |
| 36 44 |  | 
| 37 45 | 
             
            ## v0.1.0
         | 
| 38 46 |  | 
| 39 | 
            -
            Broken.
         | 
| 47 | 
            +
            * Broken.
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,28 +1,22 @@ | |
| 1 1 | 
             
            # UTF8Cleaner
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
            Removes invalid UTF-8 characters from the environment so that your app doesn't choke
         | 
| 6 | 
            -
            on them. This prevents errors like "invalid byte sequence in UTF-8".
         | 
| 3 | 
            +
            Rack middleware to remove invalid UTF-8 characters from the environment so that your
         | 
| 4 | 
            +
            app doesn't choke on them. Prevents errors like "invalid byte sequence in UTF-8".
         | 
| 7 5 |  | 
| 8 6 | 
             
            ## Installation
         | 
| 9 7 |  | 
| 10 | 
            -
            Add this line to your application's Gemfile | 
| 11 | 
            -
             | 
| 12 | 
            -
                gem 'utf8-cleaner'
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            And then execute:
         | 
| 8 | 
            +
            Add this line to your application's `Gemfile`:
         | 
| 15 9 |  | 
| 16 | 
            -
             | 
| 10 | 
            +
            ```ruby
         | 
| 11 | 
            +
            gem 'utf8-cleaner'
         | 
| 12 | 
            +
            ```
         | 
| 17 13 |  | 
| 18 | 
            -
             | 
| 14 | 
            +
            If you're not running Rails, you'll have to add the middleware to your `config.ru`:
         | 
| 19 15 |  | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                require 'utf8-cleaner'
         | 
| 25 | 
            -
                use UTF8Cleaner::Middleware
         | 
| 16 | 
            +
            ```ruby
         | 
| 17 | 
            +
            require 'utf8-cleaner'
         | 
| 18 | 
            +
            use UTF8Cleaner::Middleware
         | 
| 19 | 
            +
            ```
         | 
| 26 20 |  | 
| 27 21 | 
             
            ## Usage
         | 
| 28 22 |  | 
| @@ -38,10 +32,10 @@ There's nothing to "use". It just works! | |
| 38 32 |  | 
| 39 33 | 
             
            ## Credits
         | 
| 40 34 |  | 
| 41 | 
            -
            Original middleware author: @phoet - https://gist.github.com/phoet/1336754
         | 
| 42 | 
            -
             | 
| 35 | 
            +
            * Original middleware author: @phoet - https://gist.github.com/phoet/1336754
         | 
| 43 36 | 
             
            * Ruby 1.9.3 compatibility: @pithyless - https://gist.github.com/pithyless/3639014
         | 
| 44 37 | 
             
            * Code review and cleanup: @nextmat
         | 
| 45 38 | 
             
            * POST body sanitization: @salrepe
         | 
| 46 39 | 
             
            * Bug fixes: @cosine
         | 
| 47 40 | 
             
            * Rails 5 deprecation fix: @benlovell
         | 
| 41 | 
            +
            * Rack 3 support: @johnnyshields
         | 
    
        data/Rakefile
    CHANGED
    
    
| @@ -1,24 +1,25 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            require 'active_support/multibyte/unicode'
         | 
| 2 4 |  | 
| 3 5 | 
             
            module UTF8Cleaner
         | 
| 4 6 | 
             
              class Middleware
         | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
                ]
         | 
| 7 | 
            +
                SANITIZE_ENV_KEYS = %w[
         | 
| 8 | 
            +
                  HTTP_REFERER
         | 
| 9 | 
            +
                  HTTP_USER_AGENT
         | 
| 10 | 
            +
                  PATH_INFO
         | 
| 11 | 
            +
                  QUERY_STRING
         | 
| 12 | 
            +
                  REQUEST_PATH
         | 
| 13 | 
            +
                  REQUEST_URI
         | 
| 14 | 
            +
                  HTTP_COOKIE
         | 
| 15 | 
            +
                ].freeze
         | 
| 15 16 |  | 
| 16 17 | 
             
                def initialize(app)
         | 
| 17 | 
            -
             | 
| 18 | 
            +
                  @app = app
         | 
| 18 19 | 
             
                end
         | 
| 19 20 |  | 
| 20 21 | 
             
                def call(env)
         | 
| 21 | 
            -
             | 
| 22 | 
            +
                  @app.call(sanitize_env(env))
         | 
| 22 23 | 
             
                end
         | 
| 23 24 |  | 
| 24 25 | 
             
                private
         | 
| @@ -26,6 +27,7 @@ module UTF8Cleaner | |
| 26 27 | 
             
                include ActiveSupport::Multibyte::Unicode
         | 
| 27 28 |  | 
| 28 29 | 
             
                def sanitize_env(env)
         | 
| 30 | 
            +
                  env = env.dup # Do not mutate the original
         | 
| 29 31 | 
             
                  sanitize_env_keys(env)
         | 
| 30 32 | 
             
                  sanitize_env_rack_input(env)
         | 
| 31 33 | 
             
                  env
         | 
| @@ -33,34 +35,47 @@ module UTF8Cleaner | |
| 33 35 |  | 
| 34 36 | 
             
                def sanitize_env_keys(env)
         | 
| 35 37 | 
             
                  SANITIZE_ENV_KEYS.each do |key|
         | 
| 36 | 
            -
                    next unless value = env[key]
         | 
| 38 | 
            +
                    next unless (value = env[key])
         | 
| 37 39 | 
             
                    env[key] = cleaned_string(value)
         | 
| 38 40 | 
             
                  end
         | 
| 39 41 | 
             
                end
         | 
| 40 42 |  | 
| 41 43 | 
             
                def sanitize_env_rack_input(env)
         | 
| 44 | 
            +
                  return unless env['rack.input']
         | 
| 45 | 
            +
             | 
| 42 46 | 
             
                  case env['CONTENT_TYPE']
         | 
| 43 | 
            -
                  when  | 
| 47 | 
            +
                  when %r{\Aapplication/x-www-form-urlencoded}i
         | 
| 44 48 | 
             
                    # This data gets the full cleaning treatment
         | 
| 45 | 
            -
                     | 
| 46 | 
            -
                     | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            +
                    input_data = read_input(env['rack.input'])
         | 
| 50 | 
            +
                    return unless input_data
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                    cleaned_value = cleaned_string(input_data)
         | 
| 53 | 
            +
                    env['rack.input'] = StringIO.new(cleaned_value)
         | 
| 54 | 
            +
                  when %r{\Aapplication/json}i
         | 
| 49 55 | 
             
                    # This data only gets cleaning of invalid UTF-8 (e.g. from another charset)
         | 
| 50 56 | 
             
                    # but we do not URI-decode it.
         | 
| 51 | 
            -
                     | 
| 52 | 
            -
                     | 
| 53 | 
            -
             | 
| 54 | 
            -
                     | 
| 55 | 
            -
                    env['rack.input'].rewind
         | 
| 56 | 
            -
                  when 'multipart/form-data'
         | 
| 57 | 
            -
                    # Don't process the data since it may contain binary content
         | 
| 57 | 
            +
                    input_data = read_input(env['rack.input'])
         | 
| 58 | 
            +
                    return unless input_data && !input_data.ascii_only?
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                    env['rack.input'] = StringIO.new(tidy_bytes(input_data))
         | 
| 58 61 | 
             
                  else
         | 
| 59 | 
            -
                    #  | 
| 62 | 
            +
                    # Do not process multipart/form-data since it may contain binary content.
         | 
| 63 | 
            +
                    # Leave all other unknown content types alone.
         | 
| 60 64 | 
             
                  end
         | 
| 61 65 | 
             
                end
         | 
| 62 66 |  | 
| 67 | 
            +
                def read_input(input)
         | 
| 68 | 
            +
                  return nil unless input
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  data = input.read
         | 
| 71 | 
            +
                  input.rewind if input.respond_to?(:rewind)
         | 
| 72 | 
            +
                  data
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 63 75 | 
             
                def cleaned_string(value)
         | 
| 76 | 
            +
                  return value if value.nil? || value.empty?
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                  value = value.to_s
         | 
| 64 79 | 
             
                  value = tidy_bytes(value) unless value.ascii_only?
         | 
| 65 80 | 
             
                  value = URIString.new(value).cleaned if value.include?('%')
         | 
| 66 81 | 
             
                  value
         | 
    
        data/lib/utf8-cleaner/railtie.rb
    CHANGED
    
    | @@ -1,7 +1,9 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module UTF8Cleaner
         | 
| 2 4 | 
             
              class Railtie < Rails::Railtie
         | 
| 3 | 
            -
                initializer | 
| 4 | 
            -
                  app.config.middleware.insert_before | 
| 5 | 
            +
                initializer('utf8-cleaner.insert_middleware') do |app|
         | 
| 6 | 
            +
                  app.config.middleware.insert_before(0, UTF8Cleaner::Middleware)
         | 
| 5 7 | 
             
                end
         | 
| 6 8 | 
             
              end
         | 
| 7 9 | 
             
            end
         | 
| @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module UTF8Cleaner
         | 
| 2 4 | 
             
              # Cleans invalid %-encodings from URI-encoded strings.
         | 
| 3 5 | 
             
              class URIString
         | 
| @@ -32,7 +34,7 @@ module UTF8Cleaner | |
| 32 34 | 
             
                  char_array = []
         | 
| 33 35 | 
             
                  index = 0
         | 
| 34 36 |  | 
| 35 | 
            -
                  while  | 
| 37 | 
            +
                  while index < data.length do
         | 
| 36 38 | 
             
                    char = data[index]
         | 
| 37 39 |  | 
| 38 40 | 
             
                    if char == '%'
         | 
| @@ -129,6 +131,5 @@ module UTF8Cleaner | |
| 129 131 | 
             
                    4
         | 
| 130 132 | 
             
                  end
         | 
| 131 133 | 
             
                end
         | 
| 132 | 
            -
             | 
| 133 134 | 
             
              end
         | 
| 134 135 | 
             
            end
         | 
    
        data/lib/utf8-cleaner/version.rb
    CHANGED
    
    
    
        data/lib/utf8-cleaner.rb
    CHANGED
    
    | @@ -1,4 +1,6 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
            require  | 
| 4 | 
            -
            require  | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'utf8-cleaner/version'
         | 
| 4 | 
            +
            require 'utf8-cleaner/middleware'
         | 
| 5 | 
            +
            require 'utf8-cleaner/uri_string'
         | 
| 6 | 
            +
            require 'utf8-cleaner/railtie' if defined?(Rails)
         | 
    
        data/spec/middleware_spec.rb
    CHANGED
    
    | @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            require 'spec_helper'
         | 
| 2 4 | 
             
            require 'rack/lint'
         | 
| 3 5 |  | 
| @@ -37,10 +39,8 @@ module UTF8Cleaner | |
| 37 39 | 
             
                  end
         | 
| 38 40 |  | 
| 39 41 | 
             
                  describe "when rack.input is wrapped" do
         | 
| 40 | 
            -
                    # rack.input responds only to methods gets, each, rewind, read and close
         | 
| 41 | 
            -
                    # Rack::Lint::InputWrapper is the class which servers wrappers are based on
         | 
| 42 42 | 
             
                    it "removes invalid UTF-8 sequences" do
         | 
| 43 | 
            -
                      wrapped_rack_input = Rack::Lint::InputWrapper.new(StringIO.new("foo=%FFbar%F8"))
         | 
| 43 | 
            +
                      wrapped_rack_input = Rack::Lint::Wrapper::InputWrapper.new(StringIO.new("foo=%FFbar%F8"))
         | 
| 44 44 | 
             
                      env.merge!('rack.input' => wrapped_rack_input)
         | 
| 45 45 | 
             
                      new_env = Middleware.new(nil).send(:sanitize_env, env)
         | 
| 46 46 | 
             
                      expect(new_env['rack.input'].read).to eq('foo=bar')
         | 
| @@ -99,7 +99,7 @@ module UTF8Cleaner | |
| 99 99 | 
             
                # E.g. make sure Rack/Rails won't choke on them
         | 
| 100 100 | 
             
                after do
         | 
| 101 101 | 
             
                  cleaned = new_env
         | 
| 102 | 
            -
                  env.keys.reject{|key| key == 'rack.input'}.each do |key|
         | 
| 102 | 
            +
                  env.keys.reject { |key| key == 'rack.input' }.each do |key|
         | 
| 103 103 | 
             
                    URI.decode_www_form_component(cleaned[key]) if cleaned[key]
         | 
| 104 104 | 
             
                  end
         | 
| 105 105 | 
             
                end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        data/spec/uri_string_spec.rb
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 | 
            -
            #  | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
            require 'spec_helper'
         | 
| 3 4 |  | 
| 4 5 | 
             
            module UTF8Cleaner
         | 
| @@ -8,8 +9,10 @@ module UTF8Cleaner | |
| 8 9 | 
             
                let(:ascii_string)     { URIString.new('foo') }
         | 
| 9 10 | 
             
                let(:encoded_string)   { URIString.new('%26') }
         | 
| 10 11 | 
             
                let(:multibyte_string) { URIString.new('%E2%9C%93') }
         | 
| 11 | 
            -
                let(:complex_invalid_string)  | 
| 12 | 
            -
             | 
| 12 | 
            +
                let(:complex_invalid_string) do
         | 
| 13 | 
            +
                  # ------------ foo/   bar.  /  baz&  ;  √              baz
         | 
| 14 | 
            +
                  URIString.new('foo/%FFbar%2e%2fbaz%26%3B%E2%9C%93%E2%9Cbaz')
         | 
| 15 | 
            +
                end
         | 
| 13 16 | 
             
                let(:no_byte_at_all)      { URIString.new('%') }
         | 
| 14 17 | 
             
                let(:not_even_hex_chars1) { URIString.new('%x') }
         | 
| 15 18 | 
             
                let(:not_even_hex_chars2) { URIString.new('%0zhey') }
         | 
| @@ -35,7 +38,6 @@ module UTF8Cleaner | |
| 35 38 | 
             
                  it { expect(ascii_string).to be_valid }
         | 
| 36 39 | 
             
                  it { expect(encoded_string).to be_valid }
         | 
| 37 40 | 
             
                  it { expect(multibyte_string).to be_valid }
         | 
| 38 | 
            -
             | 
| 39 41 | 
             
                  it { expect(invalid_string).to_not be_valid }
         | 
| 40 42 | 
             
                  it { expect(complex_invalid_string).to_not be_valid }
         | 
| 41 43 | 
             
                  it { expect(no_byte_at_all).to_not be_valid }
         | 
| @@ -43,7 +45,5 @@ module UTF8Cleaner | |
| 43 45 | 
             
                  it { expect(not_even_hex_chars2).to_not be_valid }
         | 
| 44 46 | 
             
                  it { expect(mixed_encodings).to_not be_valid }
         | 
| 45 47 | 
             
                end
         | 
| 46 | 
            -
             | 
| 47 48 | 
             
              end
         | 
| 48 | 
            -
             | 
| 49 49 | 
             
            end
         | 
    
        data/utf8-cleaner.gemspec
    CHANGED
    
    | @@ -1,31 +1,27 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'utf8-cleaner/version'
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require_relative 'lib/utf8-cleaner/version'
         | 
| 5 4 |  | 
| 6 5 | 
             
            Gem::Specification.new do |gem|
         | 
| 7 | 
            -
              gem.name          =  | 
| 6 | 
            +
              gem.name          = 'utf8-cleaner'
         | 
| 8 7 | 
             
              gem.version       = UTF8Cleaner::VERSION
         | 
| 9 | 
            -
              gem.authors       = [ | 
| 10 | 
            -
              gem.email         = [ | 
| 11 | 
            -
              gem.description   = %q{ | 
| 12 | 
            -
              gem.summary       = %q{Prevent annoying  | 
| 13 | 
            -
              gem.homepage      =  | 
| 14 | 
            -
              gem.license       =  | 
| 8 | 
            +
              gem.authors       = ['Leon Miller-Out', 'Shane Cavanaugh']
         | 
| 9 | 
            +
              gem.email         = ['leon@singlebrook.com', 'shane@shanecav.net']
         | 
| 10 | 
            +
              gem.description   = %q{Rack middleware to remove invalid UTF8 characters from web requests.}
         | 
| 11 | 
            +
              gem.summary       = %q{Prevent annoying 'invalid byte sequence in UTF-8' errors}
         | 
| 12 | 
            +
              gem.homepage      = 'https://github.com/singlebrook/utf8-cleaner'
         | 
| 13 | 
            +
              gem.license       = 'MIT'
         | 
| 15 14 |  | 
| 16 15 | 
             
              gem.files         = `git ls-files`.split($/)
         | 
| 17 16 | 
             
              gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         | 
| 18 17 | 
             
              gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            -
              gem.require_paths = [ | 
| 18 | 
            +
              gem.require_paths = ['lib']
         | 
| 20 19 |  | 
| 21 | 
            -
              gem.required_ruby_version =  | 
| 20 | 
            +
              gem.required_ruby_version = '>= 2.4'
         | 
| 22 21 |  | 
| 23 22 | 
             
              gem.add_dependency 'activesupport'
         | 
| 23 | 
            +
              gem.add_dependency 'rack', '~> 3.0'
         | 
| 24 24 |  | 
| 25 | 
            -
              gem.add_development_dependency  | 
| 26 | 
            -
              gem.add_development_dependency  | 
| 27 | 
            -
              gem.add_development_dependency "guard"
         | 
| 28 | 
            -
              gem.add_development_dependency "guard-rspec"
         | 
| 29 | 
            -
              gem.add_development_dependency "rspec"
         | 
| 30 | 
            -
              gem.add_development_dependency "rack"
         | 
| 25 | 
            +
              gem.add_development_dependency 'rake'
         | 
| 26 | 
            +
              gem.add_development_dependency 'rspec'
         | 
| 31 27 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: utf8-cleaner
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 2.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Leon Miller-Out
         | 
| 8 | 
            -
             | 
| 8 | 
            +
            - Shane Cavanaugh
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2025-10-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -25,49 +25,21 @@ dependencies: | |
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '0'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            -
              name:  | 
| 29 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            -
                requirements:
         | 
| 31 | 
            -
                - - ">="
         | 
| 32 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: '0'
         | 
| 34 | 
            -
              type: :development
         | 
| 35 | 
            -
              prerelease: false
         | 
| 36 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            -
                requirements:
         | 
| 38 | 
            -
                - - ">="
         | 
| 39 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: '0'
         | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: listen
         | 
| 43 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            -
                requirements:
         | 
| 45 | 
            -
                - - '='
         | 
| 46 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: 3.0.8
         | 
| 48 | 
            -
              type: :development
         | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                requirements:
         | 
| 52 | 
            -
                - - '='
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: 3.0.8
         | 
| 55 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            -
              name: guard
         | 
| 28 | 
            +
              name: rack
         | 
| 57 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 30 | 
             
                requirements:
         | 
| 59 | 
            -
                - - " | 
| 31 | 
            +
                - - "~>"
         | 
| 60 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: '0'
         | 
| 62 | 
            -
              type: : | 
| 33 | 
            +
                    version: '3.0'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 63 35 | 
             
              prerelease: false
         | 
| 64 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 37 | 
             
                requirements:
         | 
| 66 | 
            -
                - - " | 
| 38 | 
            +
                - - "~>"
         | 
| 67 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: '0'
         | 
| 40 | 
            +
                    version: '3.0'
         | 
| 69 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            -
              name:  | 
| 42 | 
            +
              name: rake
         | 
| 71 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 44 | 
             
                requirements:
         | 
| 73 45 | 
             
                - - ">="
         | 
| @@ -94,32 +66,18 @@ dependencies: | |
| 94 66 | 
             
                - - ">="
         | 
| 95 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 68 | 
             
                    version: '0'
         | 
| 97 | 
            -
             | 
| 98 | 
            -
              name: rack
         | 
| 99 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            -
                requirements:
         | 
| 101 | 
            -
                - - ">="
         | 
| 102 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: '0'
         | 
| 104 | 
            -
              type: :development
         | 
| 105 | 
            -
              prerelease: false
         | 
| 106 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            -
                requirements:
         | 
| 108 | 
            -
                - - ">="
         | 
| 109 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version: '0'
         | 
| 111 | 
            -
            description: Removes invalid UTF8 characters from the URL and other env vars
         | 
| 69 | 
            +
            description: Rack middleware to remove invalid UTF8 characters from web requests.
         | 
| 112 70 | 
             
            email:
         | 
| 113 71 | 
             
            - leon@singlebrook.com
         | 
| 72 | 
            +
            - shane@shanecav.net
         | 
| 114 73 | 
             
            executables: []
         | 
| 115 74 | 
             
            extensions: []
         | 
| 116 75 | 
             
            extra_rdoc_files: []
         | 
| 117 76 | 
             
            files:
         | 
| 77 | 
            +
            - ".github/workflows/test.yml"
         | 
| 118 78 | 
             
            - ".gitignore"
         | 
| 119 | 
            -
            - ".travis.yml"
         | 
| 120 79 | 
             
            - CHANGELOG.md
         | 
| 121 80 | 
             
            - Gemfile
         | 
| 122 | 
            -
            - Guardfile
         | 
| 123 81 | 
             
            - LICENSE.txt
         | 
| 124 82 | 
             
            - README.md
         | 
| 125 83 | 
             
            - Rakefile
         | 
| @@ -136,7 +94,6 @@ homepage: https://github.com/singlebrook/utf8-cleaner | |
| 136 94 | 
             
            licenses:
         | 
| 137 95 | 
             
            - MIT
         | 
| 138 96 | 
             
            metadata: {}
         | 
| 139 | 
            -
            post_install_message: 
         | 
| 140 97 | 
             
            rdoc_options: []
         | 
| 141 98 | 
             
            require_paths:
         | 
| 142 99 | 
             
            - lib
         | 
| @@ -144,17 +101,16 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 144 101 | 
             
              requirements:
         | 
| 145 102 | 
             
              - - ">="
         | 
| 146 103 | 
             
                - !ruby/object:Gem::Version
         | 
| 147 | 
            -
                  version: 2. | 
| 104 | 
            +
                  version: '2.4'
         | 
| 148 105 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 149 106 | 
             
              requirements:
         | 
| 150 107 | 
             
              - - ">="
         | 
| 151 108 | 
             
                - !ruby/object:Gem::Version
         | 
| 152 109 | 
             
                  version: '0'
         | 
| 153 110 | 
             
            requirements: []
         | 
| 154 | 
            -
            rubygems_version: 3. | 
| 155 | 
            -
            signing_key: 
         | 
| 111 | 
            +
            rubygems_version: 3.6.3
         | 
| 156 112 | 
             
            specification_version: 4
         | 
| 157 | 
            -
            summary: Prevent annoying  | 
| 113 | 
            +
            summary: Prevent annoying 'invalid byte sequence in UTF-8' errors
         | 
| 158 114 | 
             
            test_files:
         | 
| 159 115 | 
             
            - spec/middleware_spec.rb
         | 
| 160 116 | 
             
            - spec/spec_helper.rb
         | 
    
        data/.travis.yml
    DELETED
    
    
    
        data/Guardfile
    DELETED
    
    | @@ -1,9 +0,0 @@ | |
| 1 | 
            -
            # A sample Guardfile
         | 
| 2 | 
            -
            # More info at https://github.com/guard/guard#readme
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            guard :rspec, cmd: 'bundle exec rspec -b' do
         | 
| 5 | 
            -
              watch(%r{^spec/.+_spec\.rb$})
         | 
| 6 | 
            -
              watch(%r{^lib/utf8-cleaner/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
         | 
| 7 | 
            -
              watch('spec/spec_helper.rb') { "spec" }
         | 
| 8 | 
            -
            end
         | 
| 9 | 
            -
             |