Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-validate_url for 
openSUSE:Factory checked in at 2022-08-09 15:26:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-validate_url (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-validate_url.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-validate_url"

Tue Aug  9 15:26:59 2022 rev:5 rq:993530 version:1.0.15

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/rubygem-validate_url/rubygem-validate_url.changes    
    2020-10-05 19:35:24.137333670 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-validate_url.new.1521/rubygem-validate_url.changes
      2022-08-09 15:27:16.813441380 +0200
@@ -1,0 +2,6 @@
+Thu Aug  4 13:34:03 UTC 2022 - Stephan Kulow <co...@suse.com>
+
+updated to version 1.0.15
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  validate_url-1.0.13.gem

New:
----
  validate_url-1.0.15.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-validate_url.spec ++++++
--- /var/tmp/diff_new_pack.xU3Tlh/_old  2022-08-09 15:27:17.337442878 +0200
+++ /var/tmp/diff_new_pack.xU3Tlh/_new  2022-08-09 15:27:17.345442901 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-validate_url
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-validate_url
-Version:        1.0.13
+Version:        1.0.15
 Release:        0
 %define mod_name validate_url
 %define mod_full_name %{mod_name}-%{version}

++++++ validate_url-1.0.13.gem -> validate_url-1.0.15.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2020-09-23 06:46:15.000000000 +0200
+++ new/README.md       2022-05-13 08:01:18.000000000 +0200
@@ -4,11 +4,15 @@
 
 ## Installation
 
-```
-# add this to your Gemfile
+Add this to your `Gemfile`:
+
+```ruby
 gem "validate_url"
+```
+
+Or install it yourself:
 
-# or run
+```sh
 sudo gem install validate_url
 ```
 
@@ -35,6 +39,9 @@
 
   # with public suffix database https://publicsuffix.org/
   validates :homepage, url: { public_suffix: true }
+
+  # with Postgres array of urls, described 
[here](https://guides.rubyonrails.org/active_record_postgresql.html#array)
+  validates :homepage, url: { accept_array: true }
 end
 ```
 
@@ -62,7 +69,7 @@
 In your spec:
 
 ```ruby
-describe Unicorn
+RSpec.describe Unicorn
   it { is_expected.to validate_url_of(:homepage) }
 end
 ```
@@ -87,14 +94,16 @@
 Validates URL is Copyright ?? 2010-2014 
[PerfectLine](http://www.perfectline.co), LLC. It is free software, and may be
 redistributed under the terms specified in the LICENSE file.
 
-## How to push new version
+## How to push a new version
 
-```
+```sh
 rake version:bump:patch
 rake gemspec
 ```
-Fix validate_url.gemspec to remove unneeded wrong strings
-```
+
+Manually update `validate_url.gemspec` to remove incorrect strings.
+
+```sh
 gem build validate_url.gemspec
 gem push validate_url-1.0.8.gem
 ```
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/locale/it.yml new/lib/locale/it.yml
--- old/lib/locale/it.yml       2020-09-23 06:46:15.000000000 +0200
+++ new/lib/locale/it.yml       2022-05-13 08:01:18.000000000 +0200
@@ -1,4 +1,4 @@
 it:
   errors:
     messages:
-      url: non ?? un URL valido.
+      url: non ?? un URL valido
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/locale/nl.yml new/lib/locale/nl.yml
--- old/lib/locale/nl.yml       1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/nl.yml       2022-05-13 08:01:18.000000000 +0200
@@ -0,0 +1,4 @@
+nl:
+  errors:
+    messages:
+      url: is geen geldige URL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/locale/pl.yml new/lib/locale/pl.yml
--- old/lib/locale/pl.yml       2020-09-23 06:46:15.000000000 +0200
+++ new/lib/locale/pl.yml       2022-05-13 08:01:18.000000000 +0200
@@ -1,4 +1,4 @@
 pl:
   errors:
     messages:
-      url: nie jest poprawnym adresem URL.
+      url: nie jest poprawnym adresem URL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/locale/pt-PT.yml new/lib/locale/pt-PT.yml
--- old/lib/locale/pt-PT.yml    1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/pt-PT.yml    2022-05-13 08:01:18.000000000 +0200
@@ -0,0 +1,4 @@
+pt-PT:
+  errors:
+    messages:
+      url: n??o ?? uma URL v??lida
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/locale/pt.yml new/lib/locale/pt.yml
--- old/lib/locale/pt.yml       1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/pt.yml       2022-05-13 08:01:18.000000000 +0200
@@ -0,0 +1,4 @@
+pt:
+  errors:
+    messages:
+      url: n??o ?? uma URL v??lida
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/validate_url.rb new/lib/validate_url.rb
--- old/lib/validate_url.rb     2020-09-23 06:46:15.000000000 +0200
+++ new/lib/validate_url.rb     2022-05-13 08:01:18.000000000 +0200
@@ -13,28 +13,32 @@
         options.reverse_merge!(message: :url)
         options.reverse_merge!(no_local: false)
         options.reverse_merge!(public_suffix: false)
+        options.reverse_merge!(accept_array: false)
 
         super(options)
       end
 
       def validate_each(record, attribute, value)
         schemes = [*options.fetch(:schemes)].map(&:to_s)
-        begin
-          uri = URI.parse(value)
-          host = uri && uri.host
-          scheme = uri && uri.scheme
-
-          valid_raw_url = scheme && value =~ /\A#{URI::regexp([scheme])}\z/
-          valid_scheme = host && scheme && schemes.include?(scheme)
-          valid_no_local = !options.fetch(:no_local) || (host && 
host.include?('.'))
-          valid_suffix = !options.fetch(:public_suffix) || (host && 
PublicSuffix.valid?(host, :default_rule => nil))
-
-          unless valid_raw_url && valid_scheme && valid_no_local && 
valid_suffix
-            record.errors.add(attribute, options.fetch(:message), value: value)
+        if value.respond_to?(:each)
+          # Error out if we're not allowing arrays
+          if !options.include?(:accept_array) || !options.fetch(:accept_array)
+            record.errors.add(attribute, :url, **filtered_options(value))
           end
-        rescue URI::InvalidURIError
-          record.errors.add(attribute, :url, **filtered_options(value))
+
+          # We have to manually handle `:allow_nil` and `:allow_blank` since 
it's not caught by
+          # ActiveRecord's own validators. We do that by just removing all the 
nil's if we want to
+          # allow them so it's not passed on later.
+          value = value.reject(&:nil?) if options.include?(:allow_nil) && 
options.fetch(:allow_nil)
+          value = value.reject(&:blank?) if options.include?(:allow_blank) && 
options.fetch(:allow_blank)
+
+          result = value.flat_map { |v| validate_url(record, attribute, v, 
schemes) }
+          errors = result.reject(&:nil?)
+
+          return errors.any? ? errors.first : true
         end
+
+        validate_url(record, attribute, value, schemes)
       end
 
       protected
@@ -44,6 +48,23 @@
         filtered[:value] = value
         filtered
       end
+
+      def validate_url(record, attribute, value, schemes)
+        uri = URI.parse(value)
+        host = uri && uri.host
+        scheme = uri && uri.scheme
+
+        valid_raw_url = scheme && value =~ /\A#{URI::regexp([scheme])}\z/
+        valid_scheme = host && scheme && schemes.include?(scheme)
+        valid_no_local = !options.fetch(:no_local) || (host && 
host.include?('.'))
+        valid_suffix = !options.fetch(:public_suffix) || (host && 
PublicSuffix.valid?(host, :default_rule => nil))
+
+        unless valid_raw_url && valid_scheme && valid_no_local && valid_suffix
+          record.errors.add(attribute, options.fetch(:message), value: value)
+        end
+      rescue URI::InvalidURIError, URI::InvalidComponentError
+        record.errors.add(attribute, :url, **filtered_options(value))
+      end
     end
 
     module ClassMethods
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2020-09-23 06:46:15.000000000 +0200
+++ new/metadata        2022-05-13 08:01:18.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: validate_url
 version: !ruby/object:Gem::Version
-  version: 1.0.13
+  version: 1.0.15
 platform: ruby
 authors:
 - Tanel Suurhans
@@ -10,7 +10,7 @@
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2020-09-23 00:00:00.000000000 Z
+date: 2022-05-13 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: jeweler
@@ -133,8 +133,11 @@
 - lib/locale/it.yml
 - lib/locale/ja.yml
 - lib/locale/km.yml
+- lib/locale/nl.yml
 - lib/locale/pl.yml
 - lib/locale/pt-BR.yml
+- lib/locale/pt-PT.yml
+- lib/locale/pt.yml
 - lib/locale/ro.yml
 - lib/locale/ru.yml
 - lib/locale/tr.yml

Reply via email to