mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-26 03:33:58 -05:00
Fix possible error if HackMD is started with wrong workdir
In https://github.com/hackmdio/hackmd/issues/834 is described how starting HackMD crashes when using the wrong working dir. This is caused by a relative path in our upload routine. This change should fix it and prevent future crashes. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
8fe26988d1
commit
a2608c319a
4 changed files with 4 additions and 1 deletions
|
@ -261,6 +261,7 @@ There are some config settings you need to change in the files below.
|
||||||
| `errorPath` | `./public/views/error.ejs` | error template file path |
|
| `errorPath` | `./public/views/error.ejs` | error template file path |
|
||||||
| `prettyPath` | `./public/views/pretty.ejs` | pretty template file path |
|
| `prettyPath` | `./public/views/pretty.ejs` | pretty template file path |
|
||||||
| `slidePath` | `./public/views/slide.hbs` | slide template file path |
|
| `slidePath` | `./public/views/slide.hbs` | slide template file path |
|
||||||
|
| `uploadsPath` | `./public/uploads` | uploads directory - needs to be persistent when you use imageUploadType `filesystem` |
|
||||||
| `sessionName` | `connect.sid` | cookie session name |
|
| `sessionName` | `connect.sid` | cookie session name |
|
||||||
| `sessionSecret` | `secret` | cookie session secret |
|
| `sessionSecret` | `secret` | cookie session secret |
|
||||||
| `sessionLife` | `14 * 24 * 60 * 60 * 1000` | cookie session life |
|
| `sessionLife` | `14 * 24 * 60 * 60 * 1000` | cookie session life |
|
||||||
|
|
|
@ -45,6 +45,7 @@ module.exports = {
|
||||||
errorPath: './public/views/error.ejs',
|
errorPath: './public/views/error.ejs',
|
||||||
prettyPath: './public/views/pretty.ejs',
|
prettyPath: './public/views/pretty.ejs',
|
||||||
slidePath: './public/views/slide.ejs',
|
slidePath: './public/views/slide.ejs',
|
||||||
|
uploadsPath: './public/uploads',
|
||||||
// session
|
// session
|
||||||
sessionName: 'connect.sid',
|
sessionName: 'connect.sid',
|
||||||
sessionSecret: 'secret',
|
sessionSecret: 'secret',
|
||||||
|
|
|
@ -173,6 +173,7 @@ config.hackmdPath = path.join(appRootPath, config.hackmdPath)
|
||||||
config.errorPath = path.join(appRootPath, config.errorPath)
|
config.errorPath = path.join(appRootPath, config.errorPath)
|
||||||
config.prettyPath = path.join(appRootPath, config.prettyPath)
|
config.prettyPath = path.join(appRootPath, config.prettyPath)
|
||||||
config.slidePath = path.join(appRootPath, config.slidePath)
|
config.slidePath = path.join(appRootPath, config.slidePath)
|
||||||
|
config.uploadsPath = path.join(appRootPath, config.uploadsPath)
|
||||||
|
|
||||||
// make config readonly
|
// make config readonly
|
||||||
config = deepFreeze(config)
|
config = deepFreeze(config)
|
||||||
|
|
|
@ -16,7 +16,7 @@ imageRouter.post('/uploadimage', function (req, res) {
|
||||||
form.keepExtensions = true
|
form.keepExtensions = true
|
||||||
|
|
||||||
if (config.imageUploadType === 'filesystem') {
|
if (config.imageUploadType === 'filesystem') {
|
||||||
form.uploadDir = 'public/uploads'
|
form.uploadDir = config.uploadsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
form.parse(req, function (err, fields, files) {
|
form.parse(req, function (err, fields, files) {
|
||||||
|
|
Loading…
Reference in a new issue