uffizzi_core 0.6.0 → 0.6.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5db1e654767dd515b19f3848fe63f6f0c194ac998f705bc78327b10ccf0cb401
|
4
|
+
data.tar.gz: 1743714525d2fd0e149bd16c4c7f6ec8a08c56d51cbec9df7ff559491c0712e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
9
|
-
|
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
|
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
|
-
|
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
|
-
|
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 =~
|
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
|
data/lib/uffizzi_core/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2022-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|