Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tracker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,17 @@ def make_shell_context():
Advisory=Advisory, CVE=CVE, CVEGroup=CVEGroup, CVEGroupEntry=CVEGroupEntry,
CVEGroupPackage=CVEGroupPackage, User=User, Package=Package, oauth=oauth)

@app.template_filter('gitlab_encode')
def gitlab_encode(name: str) -> str:
'''Convert a Gitlab project name to variant which the Gitlab encodes in
its url / API for example mysql++ becomes mysqlplusplus.'''
from re import sub

name = sub(r'([a-zA-Z0-9]+)\+([a-zA-Z]+)', r'\1-\2', name)
name = sub(r'\+', r'plus', name)
name = sub(r'[^a-zA-Z0-9_\-\.]', r'-', name)
name = sub(r'[_\-]{2,}', r'-', name)
name = sub(r'^tree$', r'unix-tree', name)
return name

return app
4 changes: 2 additions & 2 deletions tracker/templates/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ <h1>{{ package.pkgname }}</h1>
{%- else -%}
<a href="https://www.archlinux.org/packages/?name={{ package.pkgname|urlencode }}">package</a> |
{%- endif %}
<a href="https://bugs.archlinux.org/?project=0&order=id&sort=desc&string={{ package.pkgname|urlencode }}">bugs open</a> |
<a href="https://bugs.archlinux.org/?project=0&order=id&sort=desc&status%5B%5D=closed&string={{ package.pkgname|urlencode }}">bugs closed</a> |
<a href="https://gitlab.archlinux.org/archlinux/packaging/packages/{{ package.pkgname|gitlab_encode }}/-/issues">bugs open</a> |
<a href="https://gitlab.archlinux.org/archlinux/packaging/packages/{{ package.pkgname|gitlab_encode }}/-/issues/?state=closed">bugs closed</a> |
<a href="https://wiki.archlinux.org/index.php/Special:Search?search=%22{{ package.pkgname|urlencode }}%22">Wiki</a> |
<a href="https://github.com/search?type=Repositories&q=%22{{ package.pkgname|urlencode }}%22">GitHub</a> |
<a href="https://www.google.net/search?gws_rd=cr&q=%22{{ package.pkgname|urlencode }}%22">web search</a>
Expand Down
Loading