Issues with Distill import_post() 404 error

New Distill user here, trying to set up a blog and having issues with the import process for a particular repository. I'm not totally sure if this is a matter of me not understanding the documentation right or something about the particular repo.

I have successfully set up a new Distill blog. I then tried importing a post from a Github repo created previously. However, using the import_post() command produces a 404 error.

Attempt 1

> import_post("https://github.com/vgXhc/madison-commute-demographics")
Importing https://github.com/vgXhc/madison-commute-demographics...
Error in open.connection(con, "rb") : HTTP error 404.

The repo contains an Rmd and HTML file (article.Rmd and article.html) with output: distill::distill_article specified. Maybe it's an issue with there being more than 1 Rmd file?

Also tried the links to the actual html files:

> import_post("https://github.com/vgXhc/madison-commute-demographics/raw/main/article.html")
Importing https://github.com/vgXhc/madison-commute-demographics/raw/main/article.html...
Error in open.connection(con, "rb") : HTTP error 404.
> import_post("https://github.com/vgXhc/madison-commute-demographics/blob/main/article.html")
Importing https://github.com/vgXhc/madison-commute-demographics/blob/main/article.html...
Error in open.connection(con, "rb") : HTTP error 404.

Attempt 2

The github example unfortunately doesn't work anymore (an actual 404 when trying to go to https://github.com/jjallaire/distill-article)

Instead I tried @maelle 's example from #139 :

> import_post("https://github.com/maelle/distill-standalone-post")
Importing https://github.com/maelle/distill-standalone-post...
This article does not have a creative commons license. Import anyway? [Y/n]: y
Imported to _posts/untitled
  Title: Untitled
  Author: Jones, Nora
  License: (No license detected)

That worked. I also created new test repository, with an empty template post, which also imported successfully

So I suspect it's something with the particular repository that causes issue, but I can't see what it would be.

[edit 12/21: It occurred to me that I should try

  1. create a new Github repo
  2. copy the article.Rmd into that repo and knit
  3. try importing again

Result: the import was successful. So it must be something about how the original repo is set up.]

1 Like

I think it could still be an issue. :thinking:

It the new repo you created, what is the name of the default branch ? Is it master or main ?

In https://github.com/vgXhc/madison-commute-demographics it is main, and I believe this could be the cause of the issue.

Can you confirm this for me from the feedback about your last test ?

Ooh, that may be it. It is indeed "master" for the new test repo: https://github.com/vgXhc/test2

I had actually come across this when browsing through the Github issues, but it looked like it had been fixed (issue #215)? It seems like Github is in the process of changing the default branch names, and somehow I must have ended up in between.

1 Like

Yes it has been fixed in Import Post from GitHub assumes master branch ยท Issue #215 ยท rstudio/distill ยท GitHub and the fix is already on CRAN. You should update your package
distill/NEWS.md at main ยท rstudio/distill ยท GitHub

Yes it has been fixed in Import Post from GitHub assumes master branch ยท Issue #215 ยท rstudio/distill ยท GitHub and the fix is already on CRAN. You should update your package
distill/NEWS.md at main ยท rstudio/distill ยท GitHub

I checked and I already was on 1.1. Tried removing and reinstalling the package and am still getting the 404 error. I take it you can't reproduce the import error?

The fix is not working correctly I think. I'll look at this more closely.

I opened a PR with an additional fix for this

You can try it if it is not merged before.

1 Like

Hooray, it works! Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.