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

View file

@ -115,7 +115,8 @@ app.post('/upload/:id', (req, res, next) => {
req.pipe(req.busboy); req.pipe(req.busboy);
req.busboy.on('file', (fieldname, file, filename) => { req.busboy.on('file', (fieldname, file, filename) => {
console.log('Uploading: ' + 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 => { storage.set(req.params.id, file, filename, url).then(linkAndID => {
res.json(linkAndID); res.json(linkAndID);