Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
aurweb
Commits
16718689
Verified
Commit
16718689
authored
Feb 13, 2022
by
Kevin Morris
Browse files
fix: links to cgit should be url encoded
Closes
#283
Signed-off-by:
Kevin Morris
<
kevr@0cost.org
>
parent
708ade4d
Pipeline
#15867
passed with stages
in 3 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
aurweb/scripts/rendercomment.py
View file @
16718689
...
...
@@ -2,6 +2,7 @@
import
sys
from
urllib.parse
import
quote_plus
from
xml.etree.ElementTree
import
Element
import
bleach
...
...
@@ -72,13 +73,16 @@ class GitCommitsInlineProcessor(markdown.inlinepatterns.InlineProcessor):
def
handleMatch
(
self
,
m
,
data
):
oid
=
m
.
group
(
1
)
if
oid
not
in
self
.
_repo
:
# Unk
w
own OID; preserve the orginal text.
# Unk
n
own OID; preserve the orginal text.
return
(
None
,
None
,
None
)
el
=
Element
(
'a'
)
commit_uri
=
aurweb
.
config
.
get
(
"options"
,
"commit_uri"
)
prefixlen
=
util
.
git_search
(
self
.
_repo
,
oid
)
el
.
set
(
'href'
,
commit_uri
%
(
self
.
_head
,
oid
[:
prefixlen
]))
el
.
set
(
'href'
,
commit_uri
%
(
quote_plus
(
self
.
_head
),
quote_plus
(
oid
[:
prefixlen
])
))
el
.
text
=
markdown
.
util
.
AtomicString
(
oid
[:
prefixlen
])
return
(
el
,
m
.
start
(
0
),
m
.
end
(
0
))
...
...
templates/partials/packages/actions.html
View file @
16718689
...
...
@@ -6,21 +6,21 @@
<h4>
{{ "Package Actions" | tr }}
</h4>
<ul
class=
"small"
>
<li>
<a
href=
"
/cgit/aur.git/tree/
PKGBUILD
?h={{
pkgbase.Name }}"
>
<a
href=
"
{{ config.get('options', 'source_file_uri') | format("
PKGBUILD
",
pkgbase.Name
|
quote_plus
)
}}"
>
{{ "View PKGBUILD" | tr }}
</a>
/
<a
href=
"
/cgit/aur.git/log/?h={{ pkgbase.Name
}}"
>
<a
href=
"
{{ config.get('options', 'log_uri') | format(pkgbase.Name | quote_plus)
}}"
>
{{ "View Changes" | tr }}
</a>
</li>
<li>
<a
href=
"
/cgit/aur.git/snapshot/{{ pkgbase.Name }}.tar.gz
"
>
<a
href=
"
{{ config.get('options', 'snapshot_uri') | format(pkgbase.Name | quote_plus) }}
"
>
{{ "Download snapshot" | tr }}
</a>
</li>
<li>
<a
href=
"https://wiki.archlinux.org/title/Special:Search?search
={{
pkgbase.Name }}"
>
<a
href=
"https://wiki.archlinux.org/title/Special:Search?
{{ { '
search
':
pkgbase.Name
} | urlencode
}}"
>
{{ "Search wiki" | tr }}
</a>
</li>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment