Ticket #1088 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

content-type autonegotiation is wonky

Reported by: wwaites Owned by:
Priority: awaiting triage Milestone: ckan-v1.4
Component: ckan Keywords:
Cc: Repository: ckan
Theme: none

Description

in ckan/controllers/package.py around line 130 it does some strange things...

perhaps replace with https://github.com/wwaites/autoneg

and handle redirection of these content types:

application/rdf+xml
application/turtle
text/plain
text/x-graphviz

Change History

comment:1 Changed 3 years ago by wwaites

you use the negotiate function in autoneg.py with a cfg dictionary like this,

cfg = {
    "mime_types": [
        ("application/xhtml+xml", ["html"]),
        ("text/html", ["html"],
        ("application/rdf+xml", ["rdf", "owl"]),
        ("application/turtle", ["ttl"]),
        ("text/plain", ["nt"]),
        ("text/x-graphviz", ["dot"]),
        ]

for content_type, exts in negotiate(cfg, accept_header):
    if "html" in exts: 
        render page normally
    else:
        redirect to semantic.ckan.net
}

comment:2 Changed 3 years ago by wwaites

  • Status changed from new to closed
  • Resolution set to fixed

fixed in 5c091fc08474 (bug-1088-autoneg-is-wonky) tip

Note: See TracTickets for help on using tickets.