MCPcopy
hub / github.com/desktop/desktop / getMediaType

Function getMediaType

app/src/lib/git/diff.ts:688–716  ·  view source on GitHub ↗

* Map a given file extension to the related data URL media type

(extension: string)

Source from the content-addressed store, hash-verified

686 * Map a given file extension to the related data URL media type
687 */
688function getMediaType(extension: string) {
689 if (extension === '.png') {
690 return 'image/png'
691 }
692 if (extension === '.jpg' || extension === '.jpeg') {
693 return 'image/jpg'
694 }
695 if (extension === '.gif') {
696 return 'image/gif'
697 }
698 if (extension === '.ico') {
699 return 'image/x-icon'
700 }
701 if (extension === '.webp') {
702 return 'image/webp'
703 }
704 if (extension === '.bmp') {
705 return 'image/bmp'
706 }
707 if (extension === '.avif') {
708 return 'image/avif'
709 }
710 if (extension === '.dds') {
711 return 'image/vnd-ms.dds'
712 }
713
714 // fallback value as per the spec
715 return 'text/plain'
716}
717
718/**
719 * `git diff` will write out messages about the line ending changes it knows

Callers 2

getBlobImageFunction · 0.85
getWorkingDirectoryImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected