cache: unquote() all URLs before processing to ensure correctness.
It seems osc.core and similar generate both quoted and unquoted URLs that are cached separately. Additionally, urlopen() handles quoted paths differently from os.path.*() methods which can create issues for quoted projects.
This commit is contained in:
parent
a61cf8a2f0
commit
5b6ad33773
@ -8,6 +8,7 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import urlparse
|
import urlparse
|
||||||
|
import urllib
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from osc import conf
|
from osc import conf
|
||||||
from osc.core import urlopen
|
from osc.core import urlopen
|
||||||
@ -108,6 +109,7 @@ class Cache(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get(url):
|
def get(url):
|
||||||
|
url = urllib.unquote(url)
|
||||||
match, project = Cache.match(url)
|
match, project = Cache.match(url)
|
||||||
if match:
|
if match:
|
||||||
path = Cache.path(url, project, include_file=True)
|
path = Cache.path(url, project, include_file=True)
|
||||||
@ -161,6 +163,7 @@ class Cache(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def put(url, data):
|
def put(url, data):
|
||||||
|
url = urllib.unquote(url)
|
||||||
match, project = Cache.match(url)
|
match, project = Cache.match(url)
|
||||||
if match:
|
if match:
|
||||||
path = Cache.path(url, project, include_file=True, makedirs=True)
|
path = Cache.path(url, project, include_file=True, makedirs=True)
|
||||||
@ -181,6 +184,7 @@ class Cache(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def delete(url):
|
def delete(url):
|
||||||
|
url = urllib.unquote(url)
|
||||||
match, project = Cache.match(url)
|
match, project = Cache.match(url)
|
||||||
if match:
|
if match:
|
||||||
path = Cache.path(url, project, include_file=True)
|
path = Cache.path(url, project, include_file=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user