diff --git a/netutils/cjson/CMakeLists.txt b/netutils/cjson/CMakeLists.txt index 83a6475cde7..b497e4a0170 100644 --- a/netutils/cjson/CMakeLists.txt +++ b/netutils/cjson/CMakeLists.txt @@ -30,12 +30,13 @@ if(CONFIG_NETUTILS_CJSON) set(CONFIG_NETUTILS_CJSON_VERSION "1.7.10") endif() + # GitHub requires refs/tags/ in the archive URL for tag downloads if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/cJSON) FetchContent_Declare( cJSON DOWNLOAD_NAME "v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz" DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR} - URL "${CONFIG_NETUTILS_CJSON_URL}/v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz" + URL "${CONFIG_NETUTILS_CJSON_URL}/refs/tags/v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz" SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/cJSON BINARY_DIR diff --git a/netutils/cjson/Makefile b/netutils/cjson/Makefile index d8993373d2b..683bdb3da95 100644 --- a/netutils/cjson/Makefile +++ b/netutils/cjson/Makefile @@ -49,10 +49,12 @@ CSRCS = $(CJSON_SRCDIR)$(DELIM)cJSON.c CSRCS += $(CJSON_SRCDIR)$(DELIM)cJSON_Utils.c # Download and unpack tarball if no git repo found +# GitHub requires refs/tags/ in the archive URL for tag downloads (see +# https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives) ifeq ($(wildcard $(CJSON_UNPACKNAME)/.git),) $(CJSON_TARBALL): @echo "Downloading: $(CJSON_TARBALL)" - $(Q) curl -O -L $(CONFIG_NETUTILS_CJSON_URL)/$(CJSON_TARBALL) + $(Q) curl -O -L $(CONFIG_NETUTILS_CJSON_URL)/refs/tags/$(CJSON_TARBALL) $(CJSON_UNPACKNAME): $(CJSON_TARBALL) @echo "Unpacking: $(CJSON_TARBALL) -> $(CJSON_UNPACKNAME)"