🐛 Fix event ICS download button file content (#1390)

This commit is contained in:
Simon 2024-10-11 18:30:35 +02:00 committed by GitHub
parent e592484616
commit 71dc64abf5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -119,13 +119,11 @@ export function AddToCalendarButton({
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItem <DropdownMenuItem
onClick={() => { onClick={() => {
const res = ics(calendarEvent); const data = ics(calendarEvent);
// download the file // download the file
const blob = new Blob([res], { type: "text/calendar" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a"); const link = document.createElement("a");
link.setAttribute("href", url); link.setAttribute("href", data);
link.setAttribute( link.setAttribute(
"download", "download",
`${title.toLocaleLowerCase().replace(/\s/g, "-")}.ics`, `${title.toLocaleLowerCase().replace(/\s/g, "-")}.ics`,