From 58d7737d1a1cae5e661b59eb003eefba335442b0 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Wed, 2 Oct 2024 15:19:26 -0500 Subject: [PATCH] call html_escape() in xfun 0.48 --- DESCRIPTION | 4 ++-- NEWS.md | 2 ++ R/static.R | 2 +- R/utils.R | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4b70a20..edd7bb3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: servr Type: Package Title: A Simple HTTP Server to Serve Static Files or Dynamic Documents -Version: 0.31.1 +Version: 0.31.2 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Carson", "Sievert", role = "ctb"), @@ -19,7 +19,7 @@ Depends: Imports: mime (>= 0.2), httpuv (>= 1.5.2), - xfun (>= 0.42), + xfun (>= 0.48), jsonlite Suggests: tools, diff --git a/NEWS.md b/NEWS.md index aeba392..4898222 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # CHANGES IN servr VERSION 0.32 +- Requires **xfun** >= 0.48. + # CHANGES IN servr VERSION 0.31 - A fallback `favicon.ico` will be provided if it does not exist when serving files (thanks, @MMJansen, rstudio/pagedown#329). diff --git a/R/static.R b/R/static.R index bf18176..5bf5c50 100644 --- a/R/static.R +++ b/R/static.R @@ -311,7 +311,7 @@ serve_dir = function(dir = '.', response = NULL) function(req) { readLines(idx, warn = FALSE) } else { d = file.info(list.files(path, all.files = TRUE, full.names = TRUE)) - title = xfun:::escape_html(path) + title = xfun::html_escape(path) html_doc(c(sprintf('

Index of %s

', title), fileinfo_table(d)), title = title) } diff --git a/R/utils.R b/R/utils.R index 0846848..29d3b39 100644 --- a/R/utils.R +++ b/R/utils.R @@ -9,7 +9,7 @@ fileinfo_table = function(info) { d = info$isdir; i = !is.na(d) # files/dirs x1 = paste(basename(rownames(info)), ifelse(d & i, '/', ''), sep = '') - x1 = xfun:::escape_html(x1) + x1 = xfun::html_escape(x1) x1[i] = sprintf('%s', x1[i], x1[i]) # size x2 = paste(format(info$size, scientific = FALSE, big.mark = ','), 'B')