Index pages on content server
As a user, I would like to be able to use a browser to view the content served by a Distribution as if it was being served by static file server. The root of each directory should display a listing of that directory.
If a request is made to a directory in a distribution, the content app will return an html page with a list of all files in that directory and with each item being a hyperlink to the file's location. The list of files will be determined based on the published artifacts in the publication.
Alternatively, plugins can override (or customize) this behavior by creating index.html files. The content app will first check for these files before displaying an html directory listing.
Return HTML listing of directories served by content app
This patch enables users to browse each distribution. However, the /pulp/content/ endpoint continues to return a 404.
When a user requests the 'base_url' of a Distribution or any path that ends in '/' inside the Distribution's 'base_url' path, the pulpcore-content app looks for either a PublishedArtifact or ContentArtifact with a relative path equal to 'index.html'. If no such relative path is found for the RepositoryVersion or Publication, an HTML page is dynamically generated and returned.
This rewrite looks good. The only detail I expected differently was the ability to use
where the mimetype of Content-Type for the content being responded with would match the file extension of index. Alternatively we could accept this story as-is, only support index.html and ensure Content-Type: text/html; is set on the response.
@daviddavis should we accept the story as you've written and save ^ for followup work later?
I was imagining a static JSON blob API. Maybe like the PyPI one? https://warehouse.pypa.io/api-reference/json/
Still though a pre-generated json artifacts as content is a little far fetched so we should wait until someone is actually requesting it. I'm ok with only implementing index.html for now.
We should consider using one of these libraries to easily generate a page with clickable links that looks decent.
Please register to edit this issue