Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem w/ curl 2.4 #154

Closed
wibeasley opened this issue Mar 27, 2017 · 1 comment · Fixed by #155
Closed

problem w/ curl 2.4 #154

wibeasley opened this issue Mar 27, 2017 · 1 comment · Fixed by #155
Assignees

Comments

@wibeasley
Copy link
Member

wibeasley commented Mar 27, 2017

I believe something in the new version of the curl package released this weekend is causing problems with REDCapR. I'm diagnosing things now.

Typically, you can revert to 2.3 of curl with this line of code:

devtools::install_version("curl", version = "2.3")

However, just now, I had to download the tar.gz from the archive and install it manually through RStudio.

image

I'm looking at the development versions of curl and httr now, and get report when I figure out something. Any tips in the meantime are welcome.

update 10:24am: all the dev httr (master branch on GitHub) checks pass on my computer.

update 10:46am: the problem is retrieving the content through httr:

raw_text <- httr::content(result, "text")

The result list object used to have something in the content element (specifically, the bytes of each of the 1270 characters in the first example of redcap_read_oneshot()):
image

But now it contains only a line ending:
image

@wibeasley wibeasley self-assigned this Mar 27, 2017
wibeasley added a commit that referenced this issue Mar 27, 2017
Don't pass zero-width characters for record, field, or event.  Closes
#154
@wibeasley
Copy link
Member Author

Summary:
The master branch of the repo now works with the most recent versions of the curl package. Update your local machine w/

devtools::install_github(repo="OuhscBbmc/REDCapR")

Details:
Apparently curl/httr now doesn't like zero-width characters passed as parameters. This happened the majority of the time in REDCapR --anytime there wasn't a requested filter on record, field, or event. It's solved by writing to post_body's element only if there's something to filter.

example: (inside files like redcap-read-oneshot.R)

post_body <- list(
  token                   = token,
  content                 = 'record',
  format                  = 'csv',
  type                    = 'eav',
  rawOrLabel              = raw_or_label,
  exportDataAccessGroups  = export_data_access_groups_string,
  # records                 = records_collapsed,
  # fields                  = fields_collapsed,
  # events                  = events_collapsed,
  filterLogic             = filter_logic
)

if( nchar(records_collapsed) > 0 ) post_body$records  <- records_collapsed
if( nchar(fields_collapsed ) > 0 ) post_body$fields   <- fields_collapsed
if( nchar(events_collapsed ) > 0 ) post_body$events   <- events_collapsed

Once things settle down with curl (or maybe one of the underlying libraries that was just updated), I'll see if there's a more concise solution. We'll then release to CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant