Skip to content

Commit

Permalink
call html_escape() in xfun 0.48
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 2, 2024
1 parent d120084 commit 58d7737
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand All @@ -19,7 +19,7 @@ Depends:
Imports:
mime (>= 0.2),
httpuv (>= 1.5.2),
xfun (>= 0.42),
xfun (>= 0.48),
jsonlite
Suggests:
tools,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
2 changes: 1 addition & 1 deletion R/static.R
Original file line number Diff line number Diff line change
Expand Up @@ -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('<h1>Index of %s</h1>', title), fileinfo_table(d)),
title = title)
}
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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('<a href="%s">%s</a>', x1[i], x1[i])
# size
x2 = paste(format(info$size, scientific = FALSE, big.mark = ','), 'B')
Expand Down

0 comments on commit 58d7737

Please sign in to comment.