Browse Source

(*)debug 七牛文件损坏

master
周沫沫历险记 2 years ago
parent
commit
54e54e4c06
  1. 4
      .vscode/launch.json
  2. 1
      web/routes/attachment/index.js

4
.vscode/launch.json

@ -13,7 +13,7 @@
"NODE_ENV": "development" "NODE_ENV": "development"
}, },
"args": [ "args": [
"-p", "5700", "--port", "5700",
"-u","http://localhost:4700", "-u","http://localhost:4700",
"--apiHrUrl", "http://localhost:4700", "--apiHrUrl", "http://localhost:4700",
// //
@ -21,7 +21,7 @@
"--qnsk", "w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5", "--qnsk", "w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5",
"--qnbkt", "pep-process-report", "--qnbkt", "pep-process-report",
"--qndmn", "https://pepsource.anxinyun.cn", "--qndmn", "https://pepsource.anxinyun.cn",
"--wkys", "http://10.8.30.109:14000" "--pmrs", "http://10.8.30.109:14000"
] ]
}, },
{ {

1
web/routes/attachment/index.js

@ -35,6 +35,7 @@ module.exports = {
const { filename } = ctx.request.query; const { filename } = ctx.request.query;
const fkey = decodeURI(ctx.path.slice(fetchUrl.length + 1)).replace(/\.json$/, '.js'); const fkey = decodeURI(ctx.path.slice(fetchUrl.length + 1)).replace(/\.json$/, '.js');
const publicDownloadUrl = await app.fs.attachment.download(fkey); const publicDownloadUrl = await app.fs.attachment.download(fkey);
console.log("publicDownloadUrl: ", publicDownloadUrl);
ctx.status = 200; ctx.status = 200;
if (filename) ctx.attachment(filename); if (filename) ctx.attachment(filename);
ctx.body = request.get(publicDownloadUrl); ctx.body = request.get(publicDownloadUrl);

Loading…
Cancel
Save