• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nightconcept / almandine / 14757041512

30 Apr 2025 02:28PM UTC coverage: 79.95% (-0.9%) from 80.835%
14757041512

push

github

nightconcept
fix: add and install installing wrong file

61 of 81 new or added lines in 4 files covered. (75.31%)

11 existing lines in 2 files now uncovered.

1615 of 2020 relevant lines covered (79.95%)

2.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/utils/url.lua
1
--[[
2
  URL Utilities
3

4
  Provides functions for manipulating and normalizing URLs.
5
]]
6

7
local M = {}
2✔
8

9
---
10
-- Normalize GitHub URLs by converting blob URLs to raw URLs.
11
-- @param url string The URL to normalize
12
-- @return string source_url The original or normalized source URL (for storing in manifest).
13
-- @return string download_url The URL suitable for downloading (raw content).
14
-- @return string? error_message Error message if normalization fails.
15
function M.normalize_github_url(url)
2✔
16
  if type(url) ~= "string" then
13✔
NEW
17
    return nil, nil, "URL must be a string."
×
18
  end
19

20
  -- Check if this is a GitHub blob URL
21
  local username, repo, commit, path = url:match("^https://github%.com/([^/]+)/([^/]+)/blob/([^/]+)/(.+)$")
13✔
22
  if username then -- Match successful
13✔
23
    -- Convert to raw URL for downloading
24
    local raw_url = string.format("https://raw.githubusercontent.com/%s/%s/%s/%s", username, repo, commit, path)
4✔
25
    -- Return the original blob URL as the source_url and the raw_url for download
26
    return url, raw_url
4✔
27
  end
28

29
  -- Check if it might already be a raw URL (or other downloadable URL)
30
  if url:match("^https://raw%.githubusercontent%.com/") or url:match("^https://gist%.githubusercontent%.com/") then
9✔
31
    -- Assume it's already suitable for download, return it for both
32
    return url, url
1✔
33
  end
34

35
  -- If not a recognizable GitHub URL pattern, return the original URL for both
36
  -- We assume it might be a direct download link from another source.
37
  return url, url
8✔
38
end
39

40
return M
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc