r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
685 stars 62 forks source link

failures using extra/additional repository with trailing slash #400

Open achubaty opened 2 years ago

achubaty commented 2 years ago

specifying additional cran-like repo with a trailing slash causes failures when installing packages (ℹ source packages are missing from predictiveecology.r-universe.dev).

> options(repos = c(PE = 'https://predictiveecology.r-universe.dev/'))
> pak::repo_ping()
Repository summary:                                source          
PE            @ predictiveecology.r-universe.dev     x        
CRAN          @ cran.rstudio.com                     ✓      (145ms)
BioCsoft      @ bioconductor.org                     ✓      (346ms)
BioCann       @ bioconductor.org                     ✓      (366ms)
BioCexp       @ bioconductor.org                     ✓      (580ms)
BioCworkflows @ bioconductor.org                     ✓      (449ms)

whereas, removing the trailing slash works:

> options(repos = c(PE = 'https://predictiveecology.r-universe.dev'))
> pak::repo_ping()
Repository summary:                                source          
PE            @ predictiveecology.r-universe.dev     ✓      (316ms)
CRAN          @ cran.rstudio.com                     ✓      (325ms)
BioCsoft      @ bioconductor.org                     ✓      (666ms)
BioCann       @ bioconductor.org                     ✓      (665ms)
BioCexp       @ bioconductor.org                     ✓      (885ms)
BioCworkflows @ bioconductor.org                     ✓      (863ms)
gaborcsardi commented 3 months ago

Seems like a bug in the server to me. At least almost all web servers allow double slashes there AFAICT:

❯ options(repos = c(PE = 'https://cloud.r-project.org/'))
❯ pak::repo_ping()
Repository summary:                   source aarch64-apple-darwin20
PE            @ cloud.r-project.org     ✔              ✔              (586ms)
CRAN          @ cran.rstudio.com        ✔              ✔              (623ms)
BioCsoft      @ bioconductor.org        ✔              ✔              (624ms)
BioCann       @ bioconductor.org        ✔              ✔              (821ms)
BioCexp       @ bioconductor.org        ✔              ✔              (781ms)
BioCworkflows @ bioconductor.org        ✔              ✔              (836ms)
BioCbooks     @ bioconductor.org        ✔              ✔              (751ms)
❯ curl -np -f https://predictiveecology.r-universe.dev//src/contrib/PACKAGES.gz  >/dev/null
curl: (22) The requested URL returned error: 404
❯ curl -np -f https://cloud.r-project.org//src/contrib/PACKAGES.gz  >/dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1362k  100 1362k    0     0   396k      0  0:00:03  0:00:03 --:--:--  396k
jeroen commented 3 months ago

I have turned on Normalize URLs to origin in Cloudflare now (under rules > settings). That should fix this problem at least for r-universe.