diff --git a/server/routes/calendar.js b/server/routes/calendar.js index 704304e1a..39b497d3f 100644 --- a/server/routes/calendar.js +++ b/server/routes/calendar.js @@ -105,6 +105,10 @@ const eventsSummary = (day, locale) => { }; }; +const generateURIEncodedPathAlternative = (path) => { + return [path, path.replace('@', encodeURIComponent('@'))]; +}; + const router = Router(); router.get('/calendar/today', handleErrorAsync(async (req, res) => { @@ -132,7 +136,7 @@ router.get(`${routeBase}.ics`, handleErrorAsync(async (req, res) => { renderEvents(events, res, req.query.only_first_days !== undefined); })); -router.get(`${routeBase}-@:username.ics`, handleErrorAsync(async (req, res) => { +router.get(generateURIEncodedPathAlternative(`${routeBase}-@:username.ics`), handleErrorAsync(async (req, res) => { const profiles = await req.db.all(SQL` SELECT events, customEvents FROM profiles p LEFT JOIN users u ON p.userId = u.id diff --git a/src/calendar/helpers.js b/src/calendar/helpers.js index 0ac78ffbf..ffddf4f1f 100644 --- a/src/calendar/helpers.js +++ b/src/calendar/helpers.js @@ -331,7 +331,7 @@ export class Calendar { getYear(year) { year = parseInt(year); - if (year < this._minYear || year > this._maxYear) { + if (year < this._minYear || year > this._maxYear || Number.isNaN(year)) { return null; }