Skip to content

Commit

Permalink
Merge pull request #674 from openstad/fix/document-name-generator
Browse files Browse the repository at this point in the history
fix: Use the filename from the updated file instead of creating one
  • Loading branch information
iandebruin98 authored Nov 4, 2024
2 parents 723960c + 1a6cb46 commit b17bcfa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/image-server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ app.get('/document/*',
*/
app.post('/document',
documentUpload.single('document'), (req, res, next) => {
const fileName = createFilename(req.file.originalname);
const fileName = req?.file?.filename || '';

// Check if the filename is not empty
if (!fileName) {
return res.status(400).send(JSON.stringify({ error: 'No file uploaded' }));
}

let url = `${process.env.APP_URL}/document/${encodeURIComponent(fileName)}`;

Expand Down

0 comments on commit b17bcfa

Please sign in to comment.