Verified Commit cb7ac5c3 authored by Florian Pritz's avatar Florian Pritz
Browse files

archive: Fix redirect for packages with hyphen in pkgname

https://archive.archlinux.org/repos/2016/09/01/core/os/x86_64/iana-etc-20160513-1-any.pkg.tar.xz

should redirect to

https://archive.org/download/archlinux_pkg_iana-etc/iana-etc-20160513-1-any.pkg.tar.xz



but it actually redirects to the URL with the "-etc" part missing from
the directory name. The new regex fixes this by removing the part where
pkgver is allowed to have a hyphen. The PKGBUILD manpage explains that
pkgver is explicitly not allowed to contain a hyphen so we do not need
to allow this either.

It also makes the regex more readable by using named groups for the
different parts.

Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent 5b06d2e3
......@@ -33,8 +33,7 @@ server {
}
location ~ /repos/201[3456]/.*/.*\.pkg\.tar\.xz(\.sig)? {
# Tricky regexp to separate the pkgname from the pkgver (both can contain "-")
rewrite ^/repos/.*/((.*?)-[^-/]+-[0-9]+-[^-]+.*\.pkg\.tar\.xz(\.sig)?)$ /archive.org/archlinux_pkg_$2/$1 last;
rewrite ^/repos/.*/((?<pkgname>[^/]+)-(?<pkgver>[^-/]+)-(?<pkgrel>[0-9]+)-(?<arch>[^-/]+)\.pkg\.tar\.xz(?<sig>\.sig)?)$ /archive.org/archlinux_pkg_$2/$1 last;
}
# archive.org download URLs look like:
# https://archive.org/download/archlinux_pkg_lucene__/lucene++-1.4.2-3-i686.pkg.tar.xz
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment