fix: fallback deletion url to relative path

if homeDomain is not configured via config file or env var

the deletion url is a frontend page, so it cannot simply assume it's on
the same domain as uploaded files
This commit is contained in:
Bobby Wibowo 2022-08-19 09:29:11 +07:00
parent b18b2ee312
commit 0d05da40b0
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -1103,7 +1103,7 @@ self.sendUploadResponse = async (req, res, result) => {
// If uploaded by user, add delete URL (intended for ShareX and its derivatives)
// Homepage uploader will not use this (use dashboard instead)
if (req.locals.user) {
map.deleteUrl = `${utils.conf.homeDomain}/file/${file.name}?delete`
map.deleteUrl = `${utils.conf.homeDomain || ''}/file/${file.name}?delete`
}
return map