yihui / xfun

Miscellaneous R functions
https://yihui.org/xfun/
Other
140 stars 28 forks source link

Issue with download_zip on Windows #16

Closed Atrebas closed 5 years ago

Atrebas commented 5 years ago

I have some issues with blogdown. Functions like install_hugo() ornew_site() make R crash. Unravelling the issue lead me to blogdown::install_hugo > download_zip > xfun::download_file > download > download.file. If I understood well, at the end, on windows, the first tested download method is libcurl. It seems to be the culprit. I think it would be better to first use method = "auto". Thanks.

output  <- "hugo_0.53_Windows-64bit.zip"
url     <- "https://github.com/gohugoio/hugo/releases/download/v0.53/hugo_0.53_Windows-64bit.zip"

download.file(url, output, mode = "wb", method = "auto") ## works

download.file(url, output, mode = "wb", method = "libcurl")  ## crashes badly
Atrebas commented 5 years ago

Yup. I made the change locally. It solved the issue.

yihui commented 5 years ago

What's your R version? If it is not the latest, do you mind upgrading and retrying?

Atrebas commented 5 years ago

The report above was with:

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

Indeed, no crash with:

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
yihui commented 5 years ago

There were some known issues with the libcurl method in older versions of R, so when in doubt, upgrade. Thanks for the report!