Skip to content

Commit a29f6f0

Browse files
committed
fix: svg bug
1 parent dc065f1 commit a29f6f0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/server.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
269269

270270
if (!newObject.object._id)
271271
newObject.$filter = {
272-
query: [{ key: 'pathname', value: pathname, operator: '$or' }]
272+
query: [{ key: 'pathname', value: pathname, operator: '$eq' }]
273273
}
274274

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

297297
function getSource(path, mimeType) {
298298
let readType = 'utf8'
299-
if (/^(image|audio|video)\/[-+.\w]+/.test(mimeType))
300-
readType = 'base64'
301-
299+
if (mimeType === 'image/svg+xml') {
300+
readType = 'utf8';
301+
} else if (/^(image|audio|video)\/[-+.\w]+/.test(mimeType)) {
302+
readType = 'base64';
303+
}
302304
let binary = fs.readFileSync(path);
303305
let content = new Buffer.from(binary).toString(readType);
304306

0 commit comments

Comments
 (0)