Properly derive base URL as configured in file upload logic
Fixes https://github.com/timvisee/send/issues/29
This commit is contained in:
parent
b4b8060a78
commit
4c45d6217d
@ -28,8 +28,7 @@ module.exports = async function(req, res) {
|
||||
//this hasn't been updated to expiration time setting yet
|
||||
//if you want to fallback to this code add this
|
||||
await storage.set(newId, fileStream, meta, config.default_expire_seconds);
|
||||
const protocol = config.env === 'production' ? 'https' : req.protocol;
|
||||
const url = `${protocol}://${req.get('host')}/download/${newId}/`;
|
||||
const url = `${config.deriveBaseUrl(req)}/download/${newId}/`;
|
||||
res.set('WWW-Authenticate', `send-v1 ${meta.nonce}`);
|
||||
res.json({
|
||||
url,
|
||||
|
@ -65,8 +65,7 @@ module.exports = function(ws, req) {
|
||||
nonce: crypto.randomBytes(16).toString('base64')
|
||||
};
|
||||
|
||||
const protocol = config.env === 'production' ? 'https' : req.protocol;
|
||||
const url = `${protocol}://${req.get('host')}/download/${newId}/`;
|
||||
const url = `${config.deriveBaseUrl(req)}/download/${newId}/`;
|
||||
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
|
Loading…
Reference in New Issue
Block a user