@@ 31,7 31,11 @@ M.urls = {
github = {
blob_url = function(opts)
local position = pos_to_path(opts, '#L%d', '#L%d-L%d')
- return string.format('%s/blob/%s/%s%s', opts.base_url, opts.ref, opts.filepath, position)
+ local path = 'blob'
+ if not opts.filepath or opts.filepath == '' then
+ path = 'tree'
+ end
+ return string.format('%s/%s/%s/%s%s', opts.base_url, path, opts.ref, opts.filepath, position)
end,
blame_url = function(opts)
local position = pos_to_path(opts, '#L%d', '#L%d-L%d')
@@ 185,7 189,7 @@ local function go_modcache_info(filename)
local commit = json.Origin.Hash
if json.Origin.Ref ~= nil then
- local match, _, tag = string.find(json.Origin.Ref, 'refs/tags/([^/]+)')
+ local match, _, tag = string.find(json.Origin.Ref, '^refs/tags/(.+)$')
if match then
commit = tag
end