Learn R Programming

reproducible (version 3.2.1)

.applyUrlRemap: Apply the user-supplied URL remap hook

Description

Internal. Consults getOption("reproducible.urlRemap"). When that option is a function, it is called as fn(url, filename) once the target filename has been resolved (which, for Google Drive URLs, requires the drive_get() lookup in assessGoogle()). The function may return a replacement URL to download from instead. A NULL return, a non-character or empty return, a return identical to the original url, or any error (which emits a warning() rather than failing the download) all mean "keep the original url". This way a broken remap can never break a download.

Usage

.applyUrlRemap(url, filename, verbose = getOption("reproducible.verbose", 1))

Value

A length-one character URL to download from (possibly the original).

Arguments

url

The original (resolved) URL.

filename

The resolved target filename, passed to the hook so the user can remap based on filename, the original url, or both.

verbose

Numeric verbosity level.