Skip to content

Commit

Permalink
Encode hash (#) in URL path (#33)
Browse files Browse the repository at this point in the history
* encode hash in path

* bump version and add NEWS
  • Loading branch information
jonocarroll authored Sep 5, 2023
1 parent 0075366 commit 221771e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: AzureGraph
Title: Simple Interface to 'Microsoft Graph'
Version: 1.3.2
Version: 1.3.3
Authors@R: c(
person("Hong", "Ooi", , "[email protected]", role = c("aut", "cre")),
person("Microsoft", role="cph")
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# AzureGraph 1.3.3

- Paths containing a hash (#) are encoded in `call_graph_endpoint()` and no longer fail with 404

# AzureGraph 1.3.2

- Minor backend fixes.
Expand Down
6 changes: 6 additions & 0 deletions R/call_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ call_graph_endpoint <- function(token, operation, ..., options=list(),
{
url <- find_resource_host(token)
url$path <- construct_path(api_version, operation)
url$path <- encode_hash(url$path)
url$query <- options

call_graph_url(token, url, ...)
Expand Down Expand Up @@ -138,6 +139,11 @@ construct_path <- function(...)
sub("/$", "", file.path(..., fsep="/"))
}

# paths containing hash need to be encoded
encode_hash <- function(x)
{
gsub("#", "%23", x, fixed = TRUE)
}

# display confirmation prompt, return TRUE/FALSE (no NA)
get_confirmation <- function(msg, default=TRUE)
Expand Down

0 comments on commit 221771e

Please sign in to comment.