Browse Source

upload img bug

maguohua1 7 years ago
parent
commit
b833f2c334
5 changed files with 3 additions and 2 deletions
  1. BIN
      .DS_Store
  2. 1 0
      .gitignore
  3. 1 1
      app.js
  4. 1 1
      prototype/baseComponent.js
  5. BIN
      public/.DS_Store

BIN
.DS_Store


+ 1 - 0
.gitignore

@@ -2,6 +2,7 @@
 coverage
 package-lock.json
 .DS_Store
+**/.DS_Store
 .env.local
 .env.development.local
 .env.test.local

+ 1 - 1
app.js

@@ -21,7 +21,7 @@ app.all('*', (req, res, next) => {
   	res.header("Access-Control-Allow-Credentials", true); //可以带cookies
 	res.header("X-Powered-By", '3.2.1')
 	if (req.method == 'OPTIONS') {
-	  	res.send(200);
+	  	res.sendStatus(200);
 	} else {
 	    next();
 	}

+ 1 - 1
prototype/baseComponent.js

@@ -112,7 +112,7 @@ export default class BaseComponent {
 				const fullName = imgName + path.extname(files.file.name);
 				const repath = './public/img/' + fullName;
 				try{
-					await fs.rename(files.file.path, repath);
+					fs.renameSync(files.file.path, repath);
 					gm(repath)
 					.resize(200, 200, "!")
 					.write(repath, async (err) => {

BIN
public/.DS_Store