hardcode prod to https urls

This commit is contained in:
Danny Coates 2017-06-07 16:55:11 -07:00
parent 1c67eea2f0
commit 82b71b2af7
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
1 changed files with 2 additions and 1 deletions

View File

@ -115,7 +115,8 @@ app.post('/upload/:id', (req, res, next) => {
req.pipe(req.busboy);
req.busboy.on('file', (fieldname, file, filename) => {
console.log('Uploading: ' + filename);
let url = `${req.protocol}://${req.get('host')}/download/${req.params.id}/`;
const protocol = conf.env === 'development' ? req.protocol : 'https';
let url = `${protocol}://${req.get('host')}/download/${req.params.id}/`;
storage.set(req.params.id, file, filename, url).then(linkAndID => {
res.json(linkAndID);