Skip to content

Commit 7001361

Browse files
committed
Ensure that we always return HTTPS links. Fixes #455
1 parent d11e38f commit 7001361

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

R/process.R

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ process <- function(resp) {
99
process.clientresp <- function(resp) {
1010
httr::stop_for_status(resp)
1111
con <- from_JSON(httr::content(resp, as = "text"))
12+
# make sure that we always return a HTTPS link
13+
con$url <- sub("^http[s]?:", "https:", con$url)
1214
if (nchar(con$error) > 0) stop(con$error, call. = FALSE)
1315
if (nchar(con$warning) > 0) warning(con$warning, call. = FALSE)
1416
if (nchar(con$message) > 0) message(con$message, call. = FALSE)
@@ -27,6 +29,8 @@ process.figure <- function(resp) {
2729
con <- from_JSON(content(resp, as = "text"))
2830
fig <- con$payload$figure
2931
fig$url <- sub("apigetfile/", "~", resp$url)
32+
# make sure that we always return a HTTPS link
33+
con$url <- sub("^http[s]?:", "https:", con$url)
3034
fig <- add_boxed(fig)
3135
fig$data[[1]]$inherit <- FALSE
3236
# any reasonable way to return a data frame?

0 commit comments

Comments
 (0)