Skip to content

Commit

Permalink
resolves #347
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed Jul 22, 2021
1 parent 9f6b4ae commit 0cee396
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Upcoming Versions
==========================================================

In the future:
...
### Minor Enhacements

* `sanitize_token()` no longer fails with lowercase characters (#347)

Version 1.0 (released 2021-07-21)
==========================================================
Expand Down
1 change: 1 addition & 0 deletions R/sanitize-token.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#' @export
sanitize_token <- function(token) {
pattern <- "^([0-9A-F]{32})(?:\\n)?$"
token <- toupper(token)

if (is.na(token)) {
stop(
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-sanitize.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ test_that("sanitize token -empty", {
regexp = "The token is an empty string, not a valid 32-character hexademical value\\."
)
})

test_that("sanitize token - lowercase (#347)", {
secret_token <- "12345678901234567890123456abcdef"
sanitize_token(secret_token)

returned <- REDCapR::sanitize_token(secret_token)
expect_equal(returned, toupper(secret_token))
})

0 comments on commit 0cee396

Please sign in to comment.