From afe6ec2501ffcc5d669f0d2a2d6a68fdadd4f62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Wed, 8 Nov 2023 13:50:16 +0100 Subject: [PATCH] Update regexps to handle zchunk, zstd and sha512 Also fix a typo in the handling of content.asc files --- lib/MirrorCache/Datamodule.pm | 4 ++-- lib/MirrorCache/Schema/ResultSet/Stat.pm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/MirrorCache/Datamodule.pm b/lib/MirrorCache/Datamodule.pm index 974a9d49..c83f5955 100644 --- a/lib/MirrorCache/Datamodule.pm +++ b/lib/MirrorCache/Datamodule.pm @@ -604,7 +604,7 @@ sub _init_path($self) { if ( $path =~ m/.*\/([^\/]*-Current[^\/]*)$/ ) { $pedantic = 1; } else { - my $path_without_common_digit_patterns = $path =~ s/(Leap-\d\d\.\d|x86_64|s390x|ppc64|aarch64|E20|sha256(\.asc)?$)\b//gr; + my $path_without_common_digit_patterns = $path =~ s/(Leap-\d\d\.\d|x86_64|s390x|ppc64|aarch64|E20|sha\d\d\d(\.asc)?$)\b//gr; $pedantic = 1 if $path_without_common_digit_patterns !~ m/.*\/([^\/]*\d\.?\d[^\/]*)$/; } } @@ -614,7 +614,7 @@ sub _init_path($self) { $self->agent; # parse headers if ( ( $self->accept_all || !$self->extra ) - && $path =~ m/\/(repodata\/repomd\.xml[^\/]*|media\.1\/(media|products)|content|.*\.sha256(\.asc)|Release(\.key|\.gpg)?|InRelease|Packages(\.gz)?|Sources(\.gz)?|.*_Arch\.(files|db|key)(\.(sig|tar\.gz(\.sig)?))?|(files|primary|other)\.xml\.gz|[Pp]ackages(\.[A-Z][A-Z])?\.(xz|gz)|gpg-pubkey.*\.asc|CHECKSUMS(\.asc)?)$/ + && $path =~ m/\/(repodata\/repomd\.xml[^\/]*|media\.1\/(media|products)|content|.*\.sha\d\d\d(\.asc)?|Release(\.key|\.gpg)?|InRelease|Packages(\.gz|\.zst)?|Sources(\.gz|\.zst)?|.*_Arch\.(files|db|key)(\.(sig|tar\.gz(\.sig)?|tar\.zst(\.sig)?))?|(files|primary|other)\.xml\.(gz|zck|zst)|[Pp]ackages(\.[A-Z][A-Z])?\.(xz|gz|zst)|gpg-pubkey.*\.asc|CHECKSUMS(\.asc)?)$/ ) { $self->must_render_from_root(1); my $time = ~time() & 0xff; diff --git a/lib/MirrorCache/Schema/ResultSet/Stat.pm b/lib/MirrorCache/Schema/ResultSet/Stat.pm index 72ee7c63..07953d13 100644 --- a/lib/MirrorCache/Schema/ResultSet/Stat.pm +++ b/lib/MirrorCache/Schema/ResultSet/Stat.pm @@ -184,7 +184,7 @@ where or ( folder_id is null and mirror_id > -2 ) -- file may be known, but requested folder is unknown - happens when realpath shows to a different folder ) -and stat.path !~ '\/(repodata\/repomd\.xml[^\/]*|media\.1\/(media|products)|content|.*\.sha256(\.asc)|Release(\.key|\.gpg)?|InRelease|Packages(\.gz)?|Sources(\.gz)?|.*_Arch\.(files|db|key)(\.(sig|tar\.gz(\.sig)?))?|(files|primary|other)\.xml\.gz|[Pp]ackages(\.[A-Z][A-Z])?\.(xz|gz)|gpg-pubkey.*\.asc|CHECKSUMS(\.asc)?)$' +and stat.path !~ '\/(repodata\/repomd\.xml[^\/]*|media\.1\/(media|products)|content|.*\.sha\d\d\d(\.asc)?|Release(\.key|\.gpg)?|InRelease|Packages(\.gz|\.zst)?|Sources(\.gz|\.zst)?|.*_Arch\.(files|db|key)(\.(sig|tar\.gz(\.sig)?|tar\.zst(\.sig)?))?|(files|primary|other)\.xml\.(gz|zck|zst)|[Pp]ackages(\.[A-Z][A-Z])?\.(xz|gz|zst)|gpg-pubkey.*\.asc|CHECKSUMS(\.asc)?)$' and lower(stat.agent) NOT LIKE '%bot%' and lower(stat.agent) NOT LIKE '%rclone%' and (