Blame SOURCES/BZ-1826299-spectool-url-ignore-query.patch

8f4e5d
commit 26a8abc746fba9c0b32eb899b96c92841a37855a
8f4e5d
Author: Michal Domonkos <mdomonko@redhat.com>
8f4e5d
Date:   Thu Mar 26 17:00:46 2020 +0100
8f4e5d
8f4e5d
    spectool: ignore query string in URL. BZ 1337544
8f4e5d
    
8f4e5d
    When constructing the target filename from the given Source or Patch URL
8f4e5d
    (sub retrieve), do not include the query string (if present).
8f4e5d
    
8f4e5d
    Example:
8f4e5d
    * Before: http://some.url/foo.tgz?arg=123 => ./foo.tgz?arg=123
8f4e5d
    * After:  http://some.url/foo.tgz?arg=123 => ./foo.tgz
8f4e5d
    
8f4e5d
    Regex explanation:
8f4e5d
    * 1st group: ([^\/]+?)
8f4e5d
        * Lazily matches one or more characters that are not a forward slash
8f4e5d
    * 2nd group: (?:\?.*)?$
8f4e5d
        * Matches a query string (if any) starting with a question mark,
8f4e5d
          followed by zero or more characters until the end of string,
8f4e5d
          without creating a capturing group (the leading ?:)
8f4e5d
8f4e5d
diff --git a/spectool.in b/spectool.in
8f4e5d
index 6f7499c..0ebf401 100644
8f4e5d
--- a/spectool.in
8f4e5d
+++ b/spectool.in
8f4e5d
@@ -198,7 +198,7 @@ sub retrievable {
8f4e5d
 sub retrieve {
8f4e5d
 	my ($where, $url) = @_;
8f4e5d
 	if (retrievable ($url)) {
8f4e5d
-		my $path = File::Spec->catfile($where, $url =~ m|([^/]+)$|);
8f4e5d
+		my $path = File::Spec->catfile($where, $url =~ m|([^\/]+?)(?:\?.*)?$|);
8f4e5d
 		print "Getting $url to $path\n";
8f4e5d
 		if (-e $path) {
8f4e5d
 			if ($force) {