Skip to content

Conversation

@jeroen
Copy link
Member

@jeroen jeroen commented Dec 2, 2025

Currently download.packages() copies the full File field from the URL in PACKAGES, including http parameters, as the local filename. So for example, if the PACKAGES file contains

Package: jsonlite
Version: 2.0.0
File: jsonlite_2.0.0.tar.gz?somekey=79fad1b6092c1d1cc71e096d02cbc7618837fda1f90b61443f09adc25caab095
...

Then the file is saved locally not as jsonlite_2.0.0.tar.gz but as the full url including the ? and = characters which are not allowed in filenames on some platforms.

To reproduce this I created a testing repo:

available.packages(repos = 'https://jeroen.github.io/testrepo/')
download.packages('jsonlite', '.', repos = 'https://jeroen.github.io/testrepo/')

The above patch makes the download behavior of R correspond to browsers, which is to remove the http-query part from the url when saving a file locally.

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 this pull request may close these issues.

2 participants