From 0e39b1476cd891ab54b01b7dae0e99edaff8dc7f Mon Sep 17 00:00:00 2001 From: James Date: Fri, 21 Jul 2023 10:41:05 +0200 Subject: [PATCH] make last slash in backup sources urls optional (#14342) --- conans/client/downloaders/caching_file_downloader.py | 1 + conans/test/integration/cache/backup_sources_test.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conans/client/downloaders/caching_file_downloader.py b/conans/client/downloaders/caching_file_downloader.py index a4ad969161c..6e60d1a1fc1 100644 --- a/conans/client/downloaders/caching_file_downloader.py +++ b/conans/client/downloaders/caching_file_downloader.py @@ -108,6 +108,7 @@ def _backup_download(self, backup_url, backups_urls, sha256, cached_path, urls, don't want silently skipping a backup because it is down. """ try: + backup_url = backup_url if backup_url.endswith("/") else backup_url + "/" self._file_downloader.download(backup_url + sha256, cached_path, sha256=sha256) self._file_downloader.download(backup_url + sha256 + ".json", cached_path + ".json") self._output.info(f"Sources for {urls} found in remote backup {backup_url}") diff --git a/conans/test/integration/cache/backup_sources_test.py b/conans/test/integration/cache/backup_sources_test.py index f8a99b3affc..7c2074f7aee 100644 --- a/conans/test/integration/cache/backup_sources_test.py +++ b/conans/test/integration/cache/backup_sources_test.py @@ -284,8 +284,8 @@ def source(self): """) client.save({"global.conf": f"core.sources:download_cache={download_cache_folder}\n" - f"core.sources:download_urls=['http://localhost:{http_server.port}/downloader/', 'origin']\n" - f"core.sources:upload_url=http://localhost:{http_server.port}/uploader/"}, + f"core.sources:download_urls=['http://localhost:{http_server.port}/downloader', 'origin']\n" + f"core.sources:upload_url=http://localhost:{http_server.port}/uploader"}, path=client.cache.cache_folder) client.save({"conanfile.py": conanfile})