Story #5378
closedIndex pages on content server
100%
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.
Related issues
Updated by dkliban@redhat.com over 5 years ago
- 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'.
Updated by dkliban@redhat.com over 5 years ago
- Related to Story #5397: As a user, I can see an index page at :24816/<CONTENT_PREFIX>/ added
Updated by bmbouter about 5 years ago
- Related to Story #5559: As a plugin writer, I cannot export my Publication to POSIX filesystems added
Updated by bmbouter about 5 years ago
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?
Updated by daviddavis about 5 years ago
bmbouter do you have some examples of some use cases where plugins/users would use something other than text/html?
Updated by bmbouter about 5 years ago
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.
Updated by bmbouter about 5 years ago
We should consider using one of these libraries to easily generate a page with clickable links that looks decent.
https://wiki.python.org/moin/Templating#HTML_Generation_Packages
Updated by dkliban@redhat.com about 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to dkliban@redhat.com
Added by dkliban@redhat.com about 5 years ago
Updated by dkliban@redhat.com about 5 years ago
- Status changed from ASSIGNED to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulpcore|3a2ad9b52e41ebc3f85abc7399e7d605457ebeb1.
Updated by dkliban@redhat.com about 5 years ago
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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