rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
134 stars 82 forks source link

index.htm is incorrectly generated when single-file publishing in a multi-file directory #109

Closed aronatkins closed 1 year ago

aronatkins commented 8 years ago

We choose to generate an index.htm file based on the number of files in the appDir: https://github.com/rstudio/rsconnect/blob/1665cb875eda99e06be21ffcdbe5010e480b67fb/R/rmdindex.R#L16-L17

This is incorrect, as the caller may have chosen a subset of those files to include in the deployment bundle.

We should only look at files already included in the bundle when deciding if we need to generate an index.htm file.

hadley commented 1 year ago

@aronatkins do you still think this is important? It doesn't look like the issue has been fixed.

aronatkins commented 1 year ago

I would love to stop generating the index.htm. We are probably far enough removed from the versions of rmarkdown, Connect shinyapps.io that necessitated its inclusion. We'll want to make this change and test against the target servers in isolation. This is mostly about deploying multiple Shiny Rmd in one bundle without an index.Rmd; rmarkdown::run hasn't always coped well.

Some versions of rsconnect were not including the index.htm in the bundle, which caused 404s for shinyapps.io when deploying certain kinds of content: https://github.com/rstudio/rsconnect/issues/106

hadley commented 1 year ago

I just tried deploying an directory containing a.Rmd and b.Rmd to connect and shinyapps.io. On connect, I think it uses the inferred appPrimaryDoc() so you see a.Rmd. On shinyapps.io, you get a 404. Given that this has been broken for ~7 years, I suspect this means that no one relies on this code path and it would be safe to delete it. To still improve the overall user experience, we could error earlier when deploying a directory containing >1 Rmds that doesn't have an index.Rmd.

aronatkins commented 1 year ago

Hm. I'll reach out privately; I'm fairly certain that this functionality is still in use.

hadley commented 1 year ago

Oh, and the motivating issue here was that we were looking in appDir; but that looks like an argument naming confusion — writeRmdIndex() is passed the bundleDir, which only contains the files in appFiles.