Skip to content

Commit

Permalink
fix uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
shohhei1126 committed Apr 30, 2024
1 parent d74e201 commit 2921fc0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ app.locals.enableGitHubGist = config.isGitHubEnable
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable

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

Expand Down
1 change: 1 addition & 0 deletions deployments/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ USER hackmd
ENV QT_QPA_PLATFORM=offscreen
WORKDIR /home/hackmd/app
COPY --chown=1500:1500 --from=BUILD /home/hackmd/app .
RUN mkdir /tmp/uploads
RUN npm install --production && npm cache clean --force && rm -rf /tmp/{core-js-banners,phantomjs}
EXPOSE 3000
ENTRYPOINT ["/home/hackmd/app/docker-entrypoint.sh"]
2 changes: 1 addition & 1 deletion lib/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = {
tmpPath: os.tmpdir(),
defaultNotePath: './public/default.md',
docsPath: './public/docs',
uploadsPath: './public/uploads',
uploadsPath: '/tmp/uploads',
// session
sessionName: 'connect.sid',
sessionSecret: 'secret',
Expand Down

0 comments on commit 2921fc0

Please sign in to comment.