Skip to content

Commit b46ea90

Browse files
committed
feat: add support for AppImage-specific checksum file patterns
Extend the regex patterns to detect .appimage.sha256 and .appimage.sha512 files. Add a test case to verify detection of these patterns in release assets.
1 parent c5763f7 commit b46ea90

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

my_unicorn/github_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class GitHubReleaseFetcher:
5858
r".*\.sum$",
5959
r".*\.hash$",
6060
r".*\.digest$",
61+
r".*appimage\.sha256$",
62+
r".*appimage\.sha512$",
6163
]
6264

6365
def __init__(self, owner: str, repo: str, session: aiohttp.ClientSession) -> None:

tests/test_github_client.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,49 @@ def test_detect_checksum_files_siyuan_example():
325325
assert "v3.2.1" in checksum_files[0].url
326326

327327

328+
def test_detect_checksum_files_appimage_patterns():
329+
"""Test detection of AppImage-specific checksum file patterns."""
330+
assets = [
331+
{
332+
"name": "myapp.AppImage",
333+
"browser_download_url": "https://example.com/myapp.AppImage",
334+
"size": 12345,
335+
"digest": "",
336+
},
337+
{
338+
"name": "myapp.appimage.sha256",
339+
"browser_download_url": "https://github.com/owner/repo/releases/download/v2.0.0/myapp.appimage.sha256",
340+
"size": 64,
341+
"digest": "",
342+
},
343+
{
344+
"name": "myapp.appimage.sha512",
345+
"browser_download_url": "https://github.com/owner/repo/releases/download/v2.0.0/myapp.appimage.sha512",
346+
"size": 128,
347+
"digest": "",
348+
},
349+
{
350+
"name": "other-app.appimage.sha256",
351+
"browser_download_url": "https://github.com/owner/repo/releases/download/v2.0.0/other-app.appimage.sha256",
352+
"size": 64,
353+
"digest": "",
354+
},
355+
]
356+
357+
checksum_files = GitHubReleaseFetcher.detect_checksum_files(assets, "v2.0.0")
358+
359+
assert len(checksum_files) == 3
360+
detected_names = [cf.filename for cf in checksum_files]
361+
assert "myapp.appimage.sha256" in detected_names
362+
assert "myapp.appimage.sha512" in detected_names
363+
assert "other-app.appimage.sha256" in detected_names
364+
365+
# All should be traditional format
366+
for cf in checksum_files:
367+
assert cf.format_type == "traditional"
368+
assert "v2.0.0" in cf.url
369+
370+
328371
def test_checksum_file_info_dataclass():
329372
"""Test ChecksumFileInfo dataclass creation and immutability."""
330373
info = ChecksumFileInfo(

0 commit comments

Comments
 (0)