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