Remove hashes when fetching URLs (bug 849439)

This commit is contained in:
Matt Basta 2013-07-10 18:29:14 -07:00
Родитель d7a7d98497
Коммит cb339548da
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -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")