Ticket #2277 defect new

Opened 7 years ago

getcontenttype property should be explicitly set on PUT

Reported by: Cyrus Daboo Owned by:
Priority: normal Milestone:
Component: web2.dav Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description

The webdav server currently relies on a mime.types file to determine the MIME content-type of a resource based on file name extension. There are several problems with this:

- file name extensions are not always present or correct - the mime.types file location is hard to get right on each OS/variant, and in some cases is not event present

This means that a file that is PUT with a correct Content-Type in the HTTP headers may not be returned with the same Content-Type.

The server should extract the Content-Type value from the HTTP PUT request header and store that as a getcontenttype property in WebDAV.

Add code like this somewhere in the PUT handling:

content_type = request.headers.getHeader("content-type") if content_type is not None:

resource.writeDeadProperty(davxml.GETContentType.fromString("%s/%s" % (content_type.mediaType, content_type.mediaSubtype,)))

Change History

1

Changed 3 years ago by <automation>

  • owner wsanchez deleted
Note: See TracTickets for help on using tickets.