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

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