Skip to content

Commit

Permalink
fix: svg bug
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Oct 8, 2023
1 parent dc065f1 commit a29f6f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ module.exports = async function file(CoCreateConfig, configPath, match) {

if (!newObject.object._id)
newObject.$filter = {
query: [{ key: 'pathname', value: pathname, operator: '$or' }]
query: [{ key: 'pathname', value: pathname, operator: '$eq' }]
}

response = await runStore(newObject);
Expand All @@ -296,9 +296,11 @@ module.exports = async function file(CoCreateConfig, configPath, match) {

function getSource(path, mimeType) {
let readType = 'utf8'
if (/^(image|audio|video)\/[-+.\w]+/.test(mimeType))
readType = 'base64'

if (mimeType === 'image/svg+xml') {
readType = 'utf8';
} else if (/^(image|audio|video)\/[-+.\w]+/.test(mimeType)) {
readType = 'base64';
}
let binary = fs.readFileSync(path);
let content = new Buffer.from(binary).toString(readType);

Expand Down

0 comments on commit a29f6f0

Please sign in to comment.