Skip to content

Commit a8ad209

Browse files
committed
Fix Layer.lookup_media_type_for_file_name() to match file names
Signed-off-by: Tobias Wolf <[email protected]>
1 parent d1fd3ab commit a8ad209

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.github/actions/features_parse/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ outputs:
1111
runs:
1212
using: composite
1313
steps:
14-
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].4
14+
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].5
1515
- id: result
1616
shell: bash
1717
run: |

.github/actions/flavors_parse/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ outputs:
1313
runs:
1414
using: composite
1515
steps:
16-
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].4
16+
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].5
1717
- id: matrix
1818
shell: bash
1919
run: |

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Installs the given GardenLinux Python library
33
inputs:
44
version:
55
description: GardenLinux Python library version
6-
default: "0.8.4"
6+
default: "0.8.5"
77
runs:
88
using: composite
99
steps:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gardenlinux"
3-
version = "0.8.4"
3+
version = "0.8.5"
44
description = "Contains tools to work with the features directory of gardenlinux, for example deducting dependencies from feature sets or validating cnames"
55
authors = ["Garden Linux Maintainers <[email protected]>"]
66
license = "Apache-2.0"

src/gardenlinux/oci/layer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def generate_metadata_from_file_name(file_name: PathLike | str, arch: str) -> di
159159
@staticmethod
160160
def lookup_media_type_for_file_name(file_name: str) -> str:
161161
"""
162-
Looks up the media type based on file extension.
162+
Looks up the media type based on file name or extension.
163163
164164
:param file_name: File path and name of the target layer
165165
@@ -170,9 +170,9 @@ def lookup_media_type_for_file_name(file_name: str) -> str:
170170
if not isinstance(file_name, PathLike):
171171
file_name = Path(file_name)
172172

173-
for suffix in GL_MEDIA_TYPES:
174-
if file_name.match(f"*.{suffix}"):
175-
return GL_MEDIA_TYPE_LOOKUP[suffix]
173+
for lookup_name in GL_MEDIA_TYPES:
174+
if file_name.match(f"*.{lookup_name}") or str(file_name) == lookup_name:
175+
return GL_MEDIA_TYPE_LOOKUP[lookup_name]
176176

177177
raise ValueError(
178178
f"Media type for {file_name} is not defined. You may want to add the definition to parse_features_lib"

0 commit comments

Comments
 (0)