mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-22 12:03:25 -04:00
(fix) add path alternative to /queer-calendar-:locale-@:username.ics where the @ is encoded (%40)
This commit is contained in:
parent
ff716a3d41
commit
83c9b09eee
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user