summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-18 15:27:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-21 11:05:51 +0000
commitffe4af4feb3d99f716ae38f9af59b1338511c30d (patch)
tree65499a653133614cca25a83958b370e5cb7fc8d4 /bitbake/lib/bb/fetch2/__init__.py
parent273b124bf6acd77b074fde2421be331721a68c11 (diff)
downloadpoky-ffe4af4feb3d99f716ae38f9af59b1338511c30d.tar.gz
bitbake: fetch2: Fix url remap issue and add testcase
Using "" as a target for .replace() is a really bad idea as it duplicates the replacement for every character in the string. Add a testcase which triggered this and correct the code to return the correct result. (Bitbake rev: 3af1ecf049d2eed56f6d319dc7df6eb4a3d4eebc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 6a38cb0955..ded3106173 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -473,7 +473,7 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
473 basename = os.path.basename(ud.localpath) 473 basename = os.path.basename(ud.localpath)
474 if basename: 474 if basename:
475 uri_basename = os.path.basename(uri_decoded[loc]) 475 uri_basename = os.path.basename(uri_decoded[loc])
476 if basename != uri_basename and result_decoded[loc].endswith(uri_basename): 476 if uri_basename and basename != uri_basename and result_decoded[loc].endswith(uri_basename):
477 result_decoded[loc] = result_decoded[loc].replace(uri_basename, basename) 477 result_decoded[loc] = result_decoded[loc].replace(uri_basename, basename)
478 elif not result_decoded[loc].endswith(basename): 478 elif not result_decoded[loc].endswith(basename):
479 result_decoded[loc] = os.path.join(result_decoded[loc], basename) 479 result_decoded[loc] = os.path.join(result_decoded[loc], basename)