Skip to content
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
09def26
map exploration, hide expired events, fix weback
chadbrokaw Aug 14, 2025
7060df9
Temporarily disable tests
chadbrokaw Aug 18, 2025
bb76f95
Revert webpack change
chadbrokaw Aug 18, 2025
5f0c362
Improve Search Header
chadbrokaw Aug 18, 2025
c64b311
fix: fix tests and cleanup code
chadbrokaw Sep 2, 2025
cb0661a
reenable tests
chadbrokaw Sep 2, 2025
3a40297
refactor: remove unused zoom change listener from SearchMap component
chadbrokaw Sep 2, 2025
9eb8bd6
fix: Fix BrowseResultsPage
chadbrokaw Sep 2, 2025
da2654a
fix: add some logging
chadbrokaw Sep 2, 2025
e4b1d20
fix: remove console log
chadbrokaw Sep 2, 2025
dc538be
attempt to fix category switching issue
chadbrokaw Sep 2, 2025
bac8449
Don't reset map init
chadbrokaw Sep 2, 2025
4d4e3c9
fix: remove logging
chadbrokaw Sep 2, 2025
a35790a
Pulling events from Open Data Portal
chadbrokaw Aug 29, 2025
baf1c5b
fix: add days of week and allow for series of events
chadbrokaw Sep 2, 2025
35929c7
fix: refresh styles
chadbrokaw Sep 15, 2025
1502628
fix: test
chadbrokaw Sep 15, 2025
38d53f3
fix: remove exploration work for eligibility filtering
chadbrokaw Sep 15, 2025
ef753be
fix: Fix some visual inconsistencies and bugs
chadbrokaw Sep 17, 2025
26c1577
rename featued events and shuffle homepage order
chadbrokaw Sep 18, 2025
b8d6546
fix: calendar section background color
chadbrokaw Sep 18, 2025
26613a6
Remove commented code
chadbrokaw Sep 18, 2025
0b20179
Merge branch 'main' into development
chadbrokaw Sep 18, 2025
d5f8563
Merge branch 'main' into development
chadbrokaw Sep 20, 2025
b3b9fae
fix: ensure https protocol
chadbrokaw Sep 20, 2025
836539b
fix: make it more robust and add security considerations
chadbrokaw Sep 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions app/components/ui/Calendar/EventCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,59 @@ const shouldEventOccurOnDay = (
return days.some((day) => dayMap[day] === dayOfWeek);
};

// Helper function to ensure URLs have proper protocol
const ensureHttpsProtocol = (url: string): string => {
if (!url || url.trim() === "") return url;

const trimmedUrl = url.trim();

// Security: Block potentially dangerous protocols
const dangerousProtocols = ["javascript", "data", "vbscript", "file", "ftp"];
const lowerUrl = trimmedUrl.toLowerCase();
if (
dangerousProtocols.some((protocol) => lowerUrl.startsWith(`${protocol}:`))
) {
return ""; // Return empty string for dangerous protocols
}

// If it already has a safe protocol, return as is
if (trimmedUrl.startsWith("http://") || trimmedUrl.startsWith("https://")) {
return trimmedUrl;
}

// If it's a relative path, return as-is
if (
trimmedUrl.startsWith("/") ||
trimmedUrl.startsWith("./") ||
trimmedUrl.startsWith("../")
) {
return trimmedUrl;
}

// Try to parse as a valid URL; if it fails, prepend https:// and try again
try {
// Try parsing as is (may throw if missing protocol)
new URL(trimmedUrl);
// If no error, but no protocol, add https://
return `https://${trimmedUrl}`;
} catch {
try {
// Try parsing with https:// prepended
const testUrl = new URL(`https://${trimmedUrl}`);

// Additional security: Ensure the URL has a valid hostname
if (testUrl.hostname && testUrl.hostname !== "localhost") {
return `https://${trimmedUrl}`;
}

// If hostname is suspicious, return original
return trimmedUrl;
} catch {
// If still invalid, return original
return trimmedUrl;
}
}
};
interface CalendarEvent extends Event {
id: string;
pageLink: string;
Expand Down Expand Up @@ -318,7 +371,7 @@ export const EventCalendar: React.FC<EventCalendarProps> = ({
title: event.event_name,
start: dayStartDate,
end: dayEndDate,
pageLink: event.more_info || "",
pageLink: ensureHttpsProtocol(event.more_info || ""),
description: event.event_description || "",
location: event.site_location_name || "",
allDay: false, // These are timed events
Expand Down Expand Up @@ -374,7 +427,7 @@ export const EventCalendar: React.FC<EventCalendarProps> = ({
title: event.event_name,
start: startDate,
end: endDate,
pageLink: event.more_info || "",
pageLink: ensureHttpsProtocol(event.more_info || ""),
description: event.event_description || "",
location: event.site_location_name || "",
allDay: isAllDayEvent,
Expand Down
Loading