Skip to content

Commit 2921fc0

Browse files
committed
fix uploads
1 parent d74e201 commit 2921fc0

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ app.locals.enableGitHubGist = config.isGitHubEnable
227227
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
228228

229229
app.use('/uploads', (req, res, next) => {
230-
if (req.session.user) next()
230+
if (req.isAuthenticated()) next()
231231
else response.errorNotFound(req, res)
232232
}, express.static(path.resolve(__dirname, config.uploadsPath), { maxAge: config.staticCacheTime }))
233233

deployments/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ USER hackmd
2323
ENV QT_QPA_PLATFORM=offscreen
2424
WORKDIR /home/hackmd/app
2525
COPY --chown=1500:1500 --from=BUILD /home/hackmd/app .
26+
RUN mkdir /tmp/uploads
2627
RUN npm install --production && npm cache clean --force && rm -rf /tmp/{core-js-banners,phantomjs}
2728
EXPOSE 3000
2829
ENTRYPOINT ["/home/hackmd/app/docker-entrypoint.sh"]

lib/config/default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
tmpPath: os.tmpdir(),
4949
defaultNotePath: './public/default.md',
5050
docsPath: './public/docs',
51-
uploadsPath: './public/uploads',
51+
uploadsPath: '/tmp/uploads',
5252
// session
5353
sessionName: 'connect.sid',
5454
sessionSecret: 'secret',

0 commit comments

Comments
 (0)