instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.41k stars 2.42k forks source link

Markdown file mimetype defined as Sega Genesis ROM #2312

Closed dgwn closed 4 months ago

dgwn commented 4 months ago

Summary:

As seen on line 308, the .md filetype is likely improperly defined as application/x-genesis-rom

Steps to reproduce:

  1. Make a GET request to get files in a folder where a markdown file is present (e.g. https://<canvas>/api/v1/folders/<folder_id>/files)
  2. Observe the response for the appropriate file. For example:
    {
        "id": "<id>",
        "uuid": "<something>",
        "folder_id": "<folder_id>",
        "display_name": "testFile.md",
        "filename": "testFile.md",
        "upload_status": "success",
        "content-type": "application/x-genesis-rom",
        ...
    }

Expected behavior:

One would expect the content-type to be text/markdown according to this IETF standards filing, and IANA.

Actual behavior:

Content type is actually defined as application/x-genesis-rom. While .md is apparently a valid file format for Sega Genesis ROM files, it seems much more likely that users would be uploading Markdown files to Course Files, rather than Sega Genesis ROMs. The current behavior makes filtering by file type unintuitive when using the content_types[] query paramater to make calls to the Canvas API.

Additional notes:

Fixing this could potentially cause breaking changes for any external tools which get a list of course files from the Canvas API and explicitly filter by application/x-genesis-rom (whether for the actual purpose of Sega Genesis ROMs, or as a workaround for the incorrect mime type definition).