From f4868a5baccc5f514326a54d8273390f66fe4bb4 Mon Sep 17 00:00:00 2001 From: Zhansong Li Date: Sat, 31 Aug 2019 11:17:57 +1000 Subject: [PATCH 1/2] fix quoting of package name --- aur.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aur.py b/aur.py index b3f9ea4..db50e7e 100644 --- a/aur.py +++ b/aur.py @@ -9,6 +9,7 @@ import tarfile import os import os.path import tempfile +import urllib DOCUMENTATION = ''' @@ -126,7 +127,7 @@ def install_with_makepkg(module, package): Install the specified package with makepkg """ module.get_bin_path('fakeroot', required=True) - f = open_url('https://aur.archlinux.org/rpc/?v=5&type=info&arg={}'.format(package)) + f = open_url('https://aur.archlinux.org/rpc/?v=5&type=info&arg={}'.format(urllib.quote(package))) result = json.loads(f.read().decode('utf8')) if result['resultcount'] != 1: return (1, '', 'package {} not found'.format(package)) From e1443632a34eff9c65d368add97bd2994e85418c Mon Sep 17 00:00:00 2001 From: Zhansong Li Date: Sat, 31 Aug 2019 17:41:39 +1000 Subject: [PATCH 2/2] use the correct module and function name --- aur.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aur.py b/aur.py index db50e7e..8819388 100644 --- a/aur.py +++ b/aur.py @@ -9,7 +9,7 @@ import tarfile import os import os.path import tempfile -import urllib +import urllib.parse DOCUMENTATION = ''' @@ -127,7 +127,7 @@ def install_with_makepkg(module, package): Install the specified package with makepkg """ module.get_bin_path('fakeroot', required=True) - f = open_url('https://aur.archlinux.org/rpc/?v=5&type=info&arg={}'.format(urllib.quote(package))) + f = open_url('https://aur.archlinux.org/rpc/?v=5&type=info&arg={}'.format(urllib.parse.quote(package))) result = json.loads(f.read().decode('utf8')) if result['resultcount'] != 1: return (1, '', 'package {} not found'.format(package))