Commit 0593c24e authored by rockyl's avatar rockyl

init1

parent 5bca472d
...@@ -126,7 +126,10 @@ async function prepareInputs(req) { ...@@ -126,7 +126,10 @@ async function prepareInputs(req) {
} }
else { else {
type = file.type; type = file.type;
extname = path.extname(file.name); if (!acceptTypes.includes(type)) {
continue;
}
extname = '.' + type.substr(type.indexOf('/') + 1);
buffer = await fs.readFile(file.path); buffer = await fs.readFile(file.path);
} }
const input = { const input = {
......
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,qCAA6B;AAC7B,yCAAwC;AACxC,iDAAwC;AACxC,0CAAyC;AACzC,6BAA4B;AAC5B,+BAA8B;AAC9B,mCAAuD;AAEvD,MAAM,aAAa,GAAG,cAAc,CAAA;AACpC,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,CAAA;AAE9D,SAAwB,QAAQ,CAAC,MAAM;IACtC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QAC3C,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAA;QAC3C,OAAO,IAAI,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,GAAG,CAAC,gBAAgB,EAAE,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QACpD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACjB,OAAO,IAAI,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;AAC/B,CAAC;AAZD,2BAYC;AAED,6BAA6B;AAC7B,KAAK,UAAU,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI;IACnC,MAAM,EAAC,IAAI,GAAG,SAAS,EAAE,OAAO,EAAC,GAAG,GAAG,CAAC,KAAK,CAAA;IAE7C,MAAM,MAAM,GAAG,MAA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,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;YACtE,OAAO,IAAA,0BAAU,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAClC;aAAM;YACN,OAAO,MAAM,CAAA;SACb;KACD;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,CAAC,CAAA;KACR;AACF,CAAC"}
\ No newline at end of file \ No newline at end of file
...@@ -72,7 +72,7 @@ async function tinify(req, res, next) { ...@@ -72,7 +72,7 @@ async function tinify(req, res, next) {
.then(result => { .then(result => {
if (result) { if (result) {
needUpdateHashMap[input.hash] = result needUpdateHashMap[input.hash] = result
}else{ } else {
result = input.url result = input.url
} }
if (typeof result === 'string') { if (typeof result === 'string') {
...@@ -125,7 +125,10 @@ async function prepareInputs(req) { ...@@ -125,7 +125,10 @@ async function prepareInputs(req) {
} }
} else { } else {
type = file.type type = file.type
extname = path.extname(file.name) if (!acceptTypes.includes(type)) {
continue
}
extname = '.' + type.substr(type.indexOf('/') + 1)
buffer = await fs.readFile(file.path) buffer = await fs.readFile(file.path)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment