uffizzi_core 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 906801fea12b493de551c88a90e6a8fb576d76e07cca94d599387a620dcca920
4
- data.tar.gz: e42b3989f0cee2e2ca4a87c7231d477cffc426d73ba26368a5ed47a60ac2c569
3
+ metadata.gz: 5db1e654767dd515b19f3848fe63f6f0c194ac998f705bc78327b10ccf0cb401
4
+ data.tar.gz: 1743714525d2fd0e149bd16c4c7f6ec8a08c56d51cbec9df7ff559491c0712e5
5
5
  SHA512:
6
- metadata.gz: 7ccf182b08308c44d6b62c00832cefd031b34abad8b7c5eace999d6c34ec43976b5d2c577c5044bcf83299cef80776a55a9ebdd56a4dc82e12013bee47dd9582
7
- data.tar.gz: 4e6a3c3921e8d360a73eeeb615c24039b362148a9f4119f04e0bfa7f8f9cff3ab8b27ed9f5923d033d482cd668f65e669a9af60609f2b060a0ed9276b56cdee2
6
+ metadata.gz: 1df17b138ba1bfca50b4b30d68012c80d2d38cf1a4ff0374d3a10ebd711eb6aa8e2aa0d62dc5652c9178ea83b7543981332d023a22e45aa409b3dbeed40c7314
7
+ data.tar.gz: 36da046695524c28f9f8d9c101d906ef32018f79f9240ce2ee10c71a7d12a7b19dbe7d182a0a867ce47d27119074a665dbb5cefd9259092325dbd1b5a323e7e2
@@ -5,9 +5,8 @@ class UffizziCore::ComposeFile::Parsers::Services::ImageParserService
5
5
  def parse(value)
6
6
  return {} if value.blank?
7
7
 
8
- parse_error = UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_image_value', value: value)
9
- image_path, tag = get_image_path_and_tag(value, parse_error)
10
- raise parse_error if image_path.blank?
8
+ image_path, tag = get_image_path_and_tag(value)
9
+ raise_parse_error(value) if image_path.blank?
11
10
 
12
11
  tag = Settings.compose.default_tag if tag.blank?
13
12
 
@@ -27,7 +26,11 @@ class UffizziCore::ComposeFile::Parsers::Services::ImageParserService
27
26
 
28
27
  private
29
28
 
30
- def get_image_path_and_tag(value, parse_error)
29
+ def raise_parse_error(value)
30
+ raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_image_value', value: value)
31
+ end
32
+
33
+ def get_image_path_and_tag(value)
31
34
  image_path_parts = value.downcase.split(':')
32
35
  case image_path_parts.size
33
36
  when 1
@@ -40,18 +43,18 @@ class UffizziCore::ComposeFile::Parsers::Services::ImageParserService
40
43
  elsif tag_pattern.match?(value)
41
44
  [image_path_parts[0], image_path_parts[1]]
42
45
  else
43
- raise parse_error
46
+ raise_parse_error(value)
44
47
  end
45
48
  when 3
46
49
  ["#{image_path_parts[0]}:#{image_path_parts[1]}", image_path_parts[2]]
47
50
  else
48
- raise parse_error
51
+ raise_parse_error(value)
49
52
  end
50
53
  end
51
54
 
52
55
  def url?(image_path)
53
56
  uri = URI(add_https_if_needed(image_path))
54
- uri.host.present? && uri.host =~ /\w+\.(\w+\.)*\w+/ && uri.path.present?
57
+ uri.host.present? && uri.host =~ /(localhost(:\d+)?|\w+\.(\w+\.)*\w+)/ && uri.path.present?
55
58
  rescue URI::InvalidURIError
56
59
  false
57
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uffizzi_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Thurman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-16 00:00:00.000000000 Z
12
+ date: 2022-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm