DavisVaughan / extrachecks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Couple of URL-related gotchas

obrl-soil opened this issue · comments

Per obrl-soil/h3jsr@a0f0bc2, URL fragments aren't allowed

Per obrl-soil/mpspline2@5530ad3, DOI URLs have to be in \doi{} not \href{} - which may require some in-text rearrangement as you can't use alt-text with \doi{}.

Is there any way you can please post CRAN's exact email response about the URL fragment issue? That is new to me and I feel like we've done this before without any issues

For the other one, since rhub picks it up (meaning you can probably trigger this locally), I think that is out of scope for extrachecks.

Found the first one, its actually a bit more ambiguous than I remembered --

Found the following (possibly) invalid URLs:
URL:
https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates
(moved to https://h3geo.org/docs/core-library/coordsystems/)
From: inst/doc/intro-to-h3jsr.html
Status: 200
Message: OK
Please change http --> https, add trailing slashes, or follow moved
content as appropriate.

It was already https, a trailing slash on a fragment breaks the link, and the content hadn't moved, so I just went with dropping the fragment rather than arguing about it.

As for the other, yes rhub picks it up but local use of devtools::check() doesn't. I guess that may change in future updates.

The problem is that you were missing the trailing slash on the url. It should be https://h3geo.org/docs/core-library/coordsystems/#faceijk-coordinates

Just to be really explicit here:

This (with no /)

https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates

redirects to:

https://h3geo.org/docs/core-library/coordsystems/#faceijk-coordinates

It does that if you just paste the url in a browser and hit enter.

That is what CRAN doesn't like. They don't want redirects in your URLs. You can check for these kinds of issues in your package with the urlchecker package. i.e. if I put that bad URL in a package README then I get this:

> urlchecker::url_check()
! Warning: README.md:166:2 Moved
<https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates>
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 https://h3geo.org/docs/core-library/coordsystems/

If I include the / correctly, then I don't get the redirect.

Surprisingly I don't have a bullet point about redirecting URLs, so I'll add one for that

Ah flip, I was putting the trailing slash right on the end, not before the hash 🤦‍♀️thanks fellas