Skip to content
Snippets Groups Projects
Commit 94b035d4 authored by Kristian Klausen's avatar Kristian Klausen :tada:
Browse files

Disable download of attachments by adding a --reject pattern

This means we can add "task" to --include-directories and remove the
href="https://bugs.archlinux.org/task/<id>" to "<id>.html" transform
logic as wget is handling it.
parent 4bae9a11
No related branches found
No related tags found
No related merge requests found
Pipeline #6187 canceled
......@@ -24,14 +24,14 @@ function _download() {
cd "${dir}"
fi
local include_directories="user,themes,ajax,javascript"
if [[ ${1} = true ]]; then
include_directories+=",task"
local reject=""
if [[ ${1} != true ]]; then
reject=("--reject" "*getfile=*")
fi
local user_agent
user_agent="albs ($(git rev-parse --short HEAD); https://gitlab.archlinux.org/archlinux/archlinux-bugs-snapshotter)"
wget --recursive \
--include-directories="${include_directories}" \
--include-directories="task,user,themes,ajax,javascript" \
--page-requisites \
--convert-links \
--adjust-extension \
......@@ -41,6 +41,7 @@ function _download() {
--max-redirect 0 \
--user-agent="${user_agent}" \
--no-verbose \
"${reject[@]}" \
--input-file=<(printf "%s\n" "${@:2}") || [[ ${?} = 8 ]] # 8 Server issued an error response.
}
......
......@@ -7,14 +7,6 @@
</xsl:copy>
</xsl:template>
<!-- Rewrite all href="https://bugs.archlinux.org/task/<id>" to "<id>.html" -->
<xsl:template match="a/@href[starts-with(normalize-space(.), 'https://bugs.archlinux.org/task/') and not(contains(., 'getfile'))]">
<xsl:attribute name="href">
<!-- -->
<xsl:value-of select="concat(substring-after(translate(. , '&#xA;', ''), 'https://bugs.archlinux.org/task/'), '.html')"/>
</xsl:attribute>
</xsl:template>
<!-- Change href for "Attached to Project: $PROJECT" to # -->
<xsl:template match="a/@href[contains(., '/index.php?project=')]">
<xsl:attribute name="href">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment