Story #5378
closed
Index pages on content server
Status:
CLOSED - CURRENTRELEASE
Description
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.
Solution¶
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.
- Tracker changed from Issue to Story
- Description updated (diff)
- % Done set to 0
This is 2 feature requests. I'm updating the description of this one and will open a separate story for the 'welcome page index'.
- Related to Story #5397: As a user, I can see an index page at :24816/<CONTENT_PREFIX>/ added
- Sprint/Milestone set to 71
- Sprint/Milestone changed from 71 to 3.0.0
- Related to Story #5559: As a plugin writer, I cannot export my Publication to POSIX filesystems added
- Description updated (diff)
This rewrite looks good. The only detail I expected differently was the ability to use
index
index.html
index.*
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?
bmbouter do you have some examples of some use cases where plugins/users would use something other than text/html?
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.
- Status changed from NEW to ASSIGNED
- Assignee set to dkliban@redhat.com
- Status changed from ASSIGNED to MODIFIED
- % Done changed from 0 to 100
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Also available in: Atom
PDF
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.
closes #5378 https://pulp.plan.io/issues/5378