Remove hashes when fetching URLs (bug 849439)
This commit is contained in:
Родитель
d7a7d98497
Коммит
cb339548da
|
@ -118,6 +118,10 @@ def try_get_resource(err, package, url, filename, resource_type="URL",
|
|||
filename=filename)
|
||||
return
|
||||
|
||||
# Kill hashes in URLs.
|
||||
if "#" in url:
|
||||
url, _ = url.split("#", 1)
|
||||
|
||||
# Pull in whatever packaged app resources are required.
|
||||
if "://" not in url:
|
||||
if err.get_resource("packaged"):
|
||||
|
|
|
@ -45,6 +45,11 @@ class TestPackagedAppLocalResource(TestCase):
|
|||
self.err, self.package, "/local.txt", ""), "read")
|
||||
self.package.read.assert_called_once_with("local.txt")
|
||||
|
||||
def test_local_url_with_hash(self):
|
||||
eq_(appbase.try_get_resource(
|
||||
self.err, self.package, "/local.txt#foo", ""), "read")
|
||||
self.package.read.assert_called_once_with("local.txt")
|
||||
|
||||
def test_local_url_relative(self):
|
||||
eq_(appbase.try_get_resource(
|
||||
self.err, self.package, "local.txt", ""), "read")
|
||||
|
|
Загрузка…
Ссылка в новой задаче