Skip to content
Permalink
Browse files
Merge pull request #2 from 5001CEM-1920SEPJAN/one-last-hope3
One last hope3
  • Loading branch information
sarkarj committed Dec 2, 2019
2 parents 2041344 + 1ba7dc6 commit f5ba19eee4c4fd5c8b9398261591e47e3f8addb1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 3 deletions.
BIN -168 KB (24%) public/articleImages/2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -2,7 +2,6 @@

const Article = require('../modules/article')
const ifs = require('../modules/imagefs')
const Image = require('../modules/image')

const editPost = async(ctx, dbName) => {
try {
@@ -13,10 +12,8 @@ const editPost = async(ctx, dbName) => {
const article = await new Article(dbName)
await article.reupload(id, body.title, body.summary, body.content, body.tag)
const {path, type} = ctx.request.files.image
const image = await new Image(dbName)
await ifs.deletePicture(`public/articleImages/${id}.png`)
await ifs.uploadPicture(path, type, `${id}`, 'public/articleImages/' )
await image.replace(`public/articleImages/${id}.png`)
ctx.redirect(`/?msg=new "${body.title}" uploaded`)
} catch(err) {
await ctx.render('error', {message: err.message})

0 comments on commit f5ba19e

Please sign in to comment.