From 57a2e44cf66d511c391c6ca3a4ff9adc1947bc4adde02b42feee09bd1a35ef36 Mon Sep 17 00:00:00 2001 From: Jan Matejek Date: Wed, 17 Sep 2014 14:54:38 +0000 Subject: [PATCH] Accepting request 249883 from home:dmacvicar:branches:devel:languages:python - Add python-urlgrabber-3.9.1-preserve-queryparams-in-urls.patch (bnc#896844) OBS-URL: https://build.opensuse.org/request/show/249883 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urlgrabber?expand=0&rev=23 --- ...r-3.9.1-preserve-queryparams-in-urls.patch | 28 +++++++++++++++++++ python-urlgrabber.changes | 6 ++++ python-urlgrabber.spec | 5 +++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 python-urlgrabber-3.9.1-preserve-queryparams-in-urls.patch diff --git a/python-urlgrabber-3.9.1-preserve-queryparams-in-urls.patch b/python-urlgrabber-3.9.1-preserve-queryparams-in-urls.patch new file mode 100644 index 0000000..6232d0d --- /dev/null +++ b/python-urlgrabber-3.9.1-preserve-queryparams-in-urls.patch @@ -0,0 +1,28 @@ +diff --unified -u -r urlgrabber-3.9.1.orig/urlgrabber/mirror.py urlgrabber-3.9.1/urlgrabber/mirror.py +--- urlgrabber-3.9.1.orig/urlgrabber/mirror.py 2014-09-16 14:44:54.582048746 +0200 ++++ urlgrabber-3.9.1/urlgrabber/mirror.py 2014-09-16 14:49:24.138034099 +0200 +@@ -88,6 +88,7 @@ + + + import random ++import urlparse + import thread # needed for locking to make this threadsafe + + from grabber import URLGrabError, CallbackObject, DEBUG +@@ -366,11 +367,12 @@ + # by overriding the configuration methods :) + + def _join_url(self, base_url, rel_url): +- if base_url.endswith('/') or rel_url.startswith('/'): +- return base_url + rel_url ++ (scheme, netloc, path, query, fragid) = urlparse.urlsplit(base_url) ++ if path.endswith('/') or rel_url.startswith('/'): ++ return urlparse.urlunsplit((scheme, netloc, path + rel_url, query, fragid)) + else: +- return base_url + '/' + rel_url +- ++ return urlparse.urlunsplit((scheme, netloc, path + '/' + rel_url, query, fragid)) ++ + def _mirror_try(self, func, url, kw): + gr = GrabRequest() + gr.func = func diff --git a/python-urlgrabber.changes b/python-urlgrabber.changes index 90738fb..57b5ff6 100644 --- a/python-urlgrabber.changes +++ b/python-urlgrabber.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Sep 16 12:38:07 UTC 2014 - dmacvicar@suse.de + +- Add python-urlgrabber-3.9.1-preserve-queryparams-in-urls.patch + (bnc#896844) + ------------------------------------------------------------------- Wed Feb 6 18:06:41 UTC 2013 - jmatejek@suse.com diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec index 723c7cf..59b9265 100644 --- a/python-urlgrabber.spec +++ b/python-urlgrabber.spec @@ -1,7 +1,7 @@ # # spec file for package python-urlgrabber # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,8 @@ License: LGPL-2.1 Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/u/urlgrabber/urlgrabber-%{version}.tar.gz Patch0: grabber_fix.diff +# PATCH-FIX-UPSTREAM bnc#896844 +Patch1: python-urlgrabber-3.9.1-preserve-queryparams-in-urls.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python-devel BuildRequires: python-pycurl @@ -46,6 +48,7 @@ throttling, authentication, proxies and more. %setup -q -n urlgrabber-%{version} sed -i "13d" urlgrabber/__init__.py # Remove wrong license header, fixes bnc#781323 %patch0 -p1 +%patch1 -p1 %build python setup.py build