Skip to content

Commit

Permalink
fix #31: decode URI, process files, and encode URI again
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed May 3, 2017
1 parent a1cfb49 commit 143f0b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/render.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ decode_paths = function(x, dcur, env, root) {
m = gregexpr(r, x)
regmatches(x, m) = lapply(regmatches(x, m), function(p) {
if (length(p) == 0) return(p)
path = gsub(r, '\\2', p)
path = decode_uri(gsub(r, '\\2', p))
path = file.path(root, path)
d0 = gsub('^(.+_files)/.+', '\\1', path)

Expand All @@ -184,7 +184,7 @@ decode_paths = function(x, dcur, env, root) {

env$dirs = c(env$dirs, unique(d0))

paste0(gsub(r, '\\1="', p), path, '"')
paste0(gsub(r, '\\1="', p), encode_uri(path), '"')
})
x
}
Expand Down
3 changes: 3 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,6 @@ clean_widget_html = function(x) {
}
x
}

decode_uri = function(...) httpuv::decodeURIComponent(...)
encode_uri = function(...) httpuv::encodeURIComponent(...)

0 comments on commit 143f0b7

Please sign in to comment.