ExternalData: Do not match directory names when resolving DATA{}
Our content link and object download infrastructure supports only blobs (files), not trees (directories). Do not allow references to end in a slash.
This commit is contained in:
parent
00d801fbfe
commit
7bb8344d50
|
@ -304,6 +304,13 @@ function(_ExternalData_arg target arg options var_file)
|
||||||
list(GET options 0 data)
|
list(GET options 0 data)
|
||||||
list(REMOVE_AT options 0)
|
list(REMOVE_AT options 0)
|
||||||
|
|
||||||
|
# Reject trailing slashes.
|
||||||
|
if("x${data}" MATCHES "[/\\]$")
|
||||||
|
message(FATAL_ERROR "Data file reference in argument\n"
|
||||||
|
" ${arg}\n"
|
||||||
|
"may not end in a slash!")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Convert to full path.
|
# Convert to full path.
|
||||||
if(IS_ABSOLUTE "${data}")
|
if(IS_ABSOLUTE "${data}")
|
||||||
set(absdata "${data}")
|
set(absdata "${data}")
|
||||||
|
@ -376,7 +383,7 @@ function(_ExternalData_arg target arg options var_file)
|
||||||
" ${arg}\n"
|
" ${arg}\n"
|
||||||
"corresponds to source tree path\n"
|
"corresponds to source tree path\n"
|
||||||
" ${reldata}\n"
|
" ${reldata}\n"
|
||||||
"that does not exist (with or without an extension)!")
|
"that does not exist as a file (with or without an extension)!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(external)
|
if(external)
|
||||||
|
@ -470,7 +477,7 @@ function(_ExternalData_arg_find_files pattern regex)
|
||||||
foreach(entry IN LISTS globbed)
|
foreach(entry IN LISTS globbed)
|
||||||
string(REGEX REPLACE "^(${regex})(\\.md5|)$" "\\1;\\2" tuple "${entry}")
|
string(REGEX REPLACE "^(${regex})(\\.md5|)$" "\\1;\\2" tuple "${entry}")
|
||||||
list(LENGTH tuple len)
|
list(LENGTH tuple len)
|
||||||
if("${len}" EQUAL 2)
|
if("${len}" EQUAL 2 AND NOT IS_DIRECTORY "${top_src}/${entry}")
|
||||||
list(GET tuple 0 relname)
|
list(GET tuple 0 relname)
|
||||||
list(GET tuple 1 alg)
|
list(GET tuple 1 alg)
|
||||||
set(name "${top_src}/${relname}")
|
set(name "${top_src}/${relname}")
|
||||||
|
|
Loading…
Reference in New Issue