Skip to content

Commit 1d0eb1e

Browse files
Fix missing repo info when repository URL ends in a slash
1 parent 8f5034b commit 1d0eb1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/categories/macros.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@
5454
{% endif %}
5555

5656
{% if repository_url and repository_url is containing("github.com/") %}
57-
{% set repo_id = repository_url | split(pat="github.com/") | last %}
57+
{% set repo_id = repository_url | split(pat="github.com/") | last | trim_end_matches(pat="/") %}
5858

5959
{% set data = load_data(url="https://api.github.com/repos/" ~ repo_id, headers=["Authorization=Bearer " ~ github_token], format="json", required=false) %}
6060
{% if data %}
6161
{% set stars = data.stargazers_count %}
6262
{% set last_activity = data.pushed_at %}
6363
{% endif %}
6464
{% elif repository_url and repository_url is containing("gitlab.com/") %}
65-
{% set repo_id = repository_url | split(pat="gitlab.com/") | last | urlencode_strict %}
65+
{% set repo_id = repository_url | split(pat="gitlab.com/") | last | trim_end_matches(pat="/") | urlencode_strict %}
6666

6767
{% set data = load_data(url="https://gitlab.com/api/v4/projects/" ~ repo_id, format="json", required=false) %}
6868
{% if data %}

0 commit comments

Comments
 (0)