Skip to content

Commit 2b17cde

Browse files
committed
chore: enforce srv protection against allow_download = FALSE
1 parent 2e690ff commit 2b17cde

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

R/tm_rmarkdown.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ srv_rmarkdown <- function(id, data, rmd_file, allow_download) {
134134
checkmate::assert_class(data, "reactive")
135135
checkmate::assert_class(isolate(data()), "teal_data")
136136
moduleServer(id, function(input, output, session) {
137-
output$download_rmd <- downloadHandler(
138-
filename = function() basename(rmd_file),
139-
content = function(file) file.copy(rmd_file, file),
140-
contentType = "text/plain"
141-
)
137+
if (allow_download) {
138+
output$download_rmd <- downloadHandler(
139+
filename = function() basename(rmd_file),
140+
content = function(file) file.copy(rmd_file, file),
141+
contentType = "text/plain"
142+
)
143+
}
142144

143145
q_r <- reactive({
144146
data_q <- req(data())

0 commit comments

Comments
 (0)