Skip to content

Commit a6d60fb

Browse files
committed
Recognize branches with slashes in names
Fixes #27
1 parent 244faa8 commit a6d60fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/nightly_link.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ module GitHubRoutes
149149
extend self
150150
include Retour::HTTPRouter
151151

152-
@[Retour::Get("/{repo_owner}/{repo_name}/{_kind:blob|tree|raw|blame|commits}/{branch}/.github/workflows/{workflow:[^/]+\\.ya?ml}")]
152+
@[Retour::Get("/{repo_owner}/{repo_name}/{_kind:blob|tree|raw|blame|commits}/{branch:.+}/.github/workflows/{workflow:[^/]+\\.ya?ml}")]
153153
def workflow_file(repo_owner, repo_name, _kind, branch, workflow, direct : Bool)
154154
NightlyLink.gen_dash_by_branch(repo_owner: repo_owner, repo_name: repo_name, workflow: workflow.rchop(".yml"), branch: branch)
155155
end
@@ -188,7 +188,7 @@ class NightlyLink
188188
})
189189

190190
def workflow_pattern(repo_owner : String, repo_name : String) : Regex
191-
%r(^https?://github.com/(#{repo_owner})/(#{repo_name})/(blob|tree|raw|blame|commits)/([^/]+)/\.github/workflows/([^/]+\.ya?ml)(#.*)?$)
191+
%r(^https?://github.com/(#{repo_owner})/(#{repo_name})/(blob|tree|raw|blame|commits)/(.+)/\.github/workflows/([^/]+\.ya?ml)(#.*)?$)
192192
end
193193

194194
def workflow_placeholder(repo_owner = "$user", repo_name = "$repo") : String

0 commit comments

Comments
 (0)