From 2fb7c0155e2a432ae9e90e4d86c882b11b53494d Mon Sep 17 00:00:00 2001 From: Jannis Gebauer Date: Wed, 24 May 2017 10:02:04 +0200 Subject: [PATCH] quote file paths --- pyup/providers/github.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyup/providers/github.py b/pyup/providers/github.py index 001bc81..8c0a593 100644 --- a/pyup/providers/github.py +++ b/pyup/providers/github.py @@ -3,6 +3,10 @@ import time import logging from github import Github, GithubException, UnknownObjectException, InputGitAuthor +try: + from urllib import quote # Python 2.X +except ImportError: + from urllib.parse import quote # Python 3+ from ..errors import BranchExistsError, NoPermissionError, RepoDoesNotExistError logger = logging.getLogger(__name__) @@ -68,7 +72,7 @@ def get_file(self, repo, path, branch): if not path.startswith("/"): path = "/" + path try: - contentfile = repo.get_contents(path, ref=branch) + contentfile = repo.get_contents(quote(path), ref=branch) return contentfile.decoded_content.decode("utf-8"), contentfile except GithubException: logger.warning("Unable to get {path} on {repo}".format(