From c6db63f9bbb0ab2c647fd72d269e530e0c3d4870 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Fri, 24 Mar 2023 09:01:06 +0100 Subject: [PATCH 1/2] fix: Fix path validation. --- R/router.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/router.R b/R/router.R index 0add4fd..b5c3c41 100644 --- a/R/router.R +++ b/R/router.R @@ -123,7 +123,7 @@ create_router_callback <- function(root, routes = NULL) { ignoreInit = FALSE, # Shiny uses the "onhashchange" browser method (via JQuery) to detect # changes to the hash - eventExpr = c(get_url_hash(session), session$clientData$url_search), + eventExpr = c(get_url_hash(session), session$clientData$url_search, input$routes), handlerExpr = { log_msg("hashchange observer triggered!") new_hash <- shiny::getUrlHash(session) @@ -141,6 +141,7 @@ create_router_callback <- function(root, routes = NULL) { parsed$path <- ifelse(parsed$path == "", root, parsed$path) is_path_valid <- if (is.null(routes)) { + shiny::req(input$routes) log_msg("Valid paths:", input$routes) !is.null(input$routes) && !(parsed$path %in% c(input$routes, "404")) } else { From 85741fe2dd70526de3cb4750f86d07223d4e2b51 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Fri, 24 Mar 2023 09:01:44 +0100 Subject: [PATCH 2/2] chore: Update package version. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index dd02c5e..51b2b0c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: shiny.router Type: Package Title: Basic Routing for Shiny Web Applications -Version: 0.3.0 +Version: 0.3.0.9000 Authors@R: c( person("Ryszard", "SzymaƄski", email = "opensource+ryszard@appsilon.com", role = c("cre", "aut")),