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

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