Check the validity of a version of an asset of a project from the registry.
This compares the size, MD5 checksums and link information in the internal ..manifest
and ..links
files to the contents of the directory in the registry.
validateVersion(project, asset, version, staging, url)
NULL
is invisibly returned if the version is valid, otherwise an error is thrown.
info <- startGobbler()
removeProject("test", info$staging, url=info$url) # start with a clean slate.
createProject("test", info$staging, url=info$url)
# Mocking up a version if it doesn't already exist.
src <- allocateUploadDirectory(info$staging)
write(file=file.path(src, "foo"), "BAR")
uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
# Validation has no issue.
validateVersion("test", "simple", "v1", staging=info$staging, url=info$url)
# Let's add a new file directly to the directory and rerun the validation.
write(file=file.path(info$registry, "test", "simple", "v1", "whee"), "stuff")
try(validateVersion("test", "simple", "v1", staging=info$staging, url=info$url))
#> Error in req_perform(req) : HTTP 500 Internal Server Error.
#> • failed to validate project; extra file "whee" is not present in manifest for directory "/tmp/RtmpQ3n0nC/file1d17e1600a4/test/simple/v1"