Skip to content

Commit

Permalink
fix: add svg content type
Browse files Browse the repository at this point in the history
  • Loading branch information
aboutlo committed Nov 23, 2023
1 parent a73d216 commit 843f505
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/getContentTypeByExtension.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function getContentTypeByExtension (ext) {
export function getContentTypeByExtension(ext) {
switch (ext.toLowerCase()) {
case '.html':
return 'text/html'
Expand All @@ -21,6 +21,8 @@ export function getContentTypeByExtension (ext) {
return 'image/jpeg'
case '.gif':
return 'image/gif'
case '.svg':
return 'application/svg+xml'
default:
return 'application/octet-stream' // default to binary data
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/getContentTypeByExtension.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('getContentTypeByExtension', () => {
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.gif': 'image/gif',
'.svg': 'application/svg+xml',
}

Object.entries(contentTypeMapping).forEach(([ext, expectedContentType]) => {
Expand Down

0 comments on commit 843f505

Please sign in to comment.