1
0
mirror of https://github.com/comatory/fb2iCal synced 2025-06-05 22:09:25 +02:00

fix: error due to inability to parse invalid unicode sequences

This commit is contained in:
Ondřej Synáček
2020-12-26 20:57:19 +01:00
parent cfa7db4f9e
commit 0683ef9666
2 changed files with 19 additions and 2 deletions

View File

@@ -1,7 +1,12 @@
import { postURL } from '../services'
import { eventStore, parseStatusStore, requestStore } from '../stores'
import { Request } from '../records'
import { uuidv4, parseStartTimeFromiCalString, promptDownload } from '../utils'
import {
uuidv4,
parseStartTimeFromiCalString,
promptDownload,
encodeIcalString,
} from '../utils'
import { extractEventDataFromHTML } from '../../../lib/services/ics-retriever'
import generateICS from '../../../lib/services/ics-generator'
@@ -35,7 +40,7 @@ const createICS = async (html, url, { logger }) => {
const eventData = extractEventDataFromHTML(html, url, { logger })
const text = await generateICS(eventData)
const dataUri = encodeURIComponent(text)
const dataUri = encodeIcalString(text)
const uri = `data:text/calendar;charset=utf-8,${dataUri}`
const summaryMatch = text.match(/SUMMARY:.*/)[0]