fix event import from URL

This commit is contained in:
lesion 2023-03-14 16:16:52 +01:00
parent e1bca6f46a
commit f7357666ca
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -197,9 +197,9 @@ module.exports = {
* It does supports ICS and H-EVENT * It does supports ICS and H-EVENT
*/ */
async importURL(req, res) { async importURL(req, res) {
const URL = req.query.URL const url = req.query.URL
try { try {
const response = await axios.get(URL) const response = await axios.get(url)
const contentType = response.headers['content-type'] const contentType = response.headers['content-type']
if (contentType.includes('text/html')) { if (contentType.includes('text/html')) {
@ -211,7 +211,7 @@ module.exports = {
const props = e.properties const props = e.properties
let media = get(props, 'featured[0]') let media = get(props, 'featured[0]')
if (media) { if (media) {
media = url.resolve(URL, media) media = URL.resolve(url, media)
} }
return { return {
title: get(props, 'name[0]', ''), title: get(props, 'name[0]', ''),