1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

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>
This commit is contained in:
Richard Purdie
2021-11-18 15:27:07 +00:00
parent 273b124bf6
commit ffe4af4feb
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -473,7 +473,7 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
basename = os.path.basename(ud.localpath)
if basename:
uri_basename = os.path.basename(uri_decoded[loc])
if basename != uri_basename and result_decoded[loc].endswith(uri_basename):
if uri_basename and basename != uri_basename and result_decoded[loc].endswith(uri_basename):
result_decoded[loc] = result_decoded[loc].replace(uri_basename, basename)
elif not result_decoded[loc].endswith(basename):
result_decoded[loc] = os.path.join(result_decoded[loc], basename)