Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .changeset/seven-deer-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
8 changes: 6 additions & 2 deletions server/src/addie/services/feed-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function validateRssContent(content: string, contentType: string): { valid: bool
}

interface FeedItem {
guid?: string;
guid?: string | { _: string };
link?: string;
title?: string;
pubDate?: string;
Expand Down Expand Up @@ -144,7 +144,11 @@ async function fetchFeed(feed: IndustryFeed): Promise<RssArticleInput[]> {
}

// Generate a stable GUID
const guid = item.guid || item.link;
// Handle RSS guids that may be objects with _ property (from XML attributes)
const rawGuid = item.guid;
const guid = typeof rawGuid === 'object' && rawGuid !== null && '_' in rawGuid
? rawGuid._
: (rawGuid || item.link);

// Parse publication date
let publishedAt: Date | undefined;
Expand Down
8 changes: 7 additions & 1 deletion server/src/db/industry-feeds-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,14 @@ function generateSlug(title: string, guid: string): string {
.replace(/^-|-$/g, '')
.substring(0, 80);

// Ensure guid is a string (defensive against RSS parser quirks)
if (typeof guid !== 'string') {
logger.warn({ guid, title }, 'generateSlug received non-string guid');
}
const guidStr = String(guid || '');

// Add a hash of the guid to ensure uniqueness
const hash = Math.abs(guid.split('').reduce((a, b) => {
const hash = Math.abs(guidStr.split('').reduce((a, b) => {
a = ((a << 5) - a) + b.charCodeAt(0);
return a & a;
}, 0)).toString(36).substring(0, 6);
Expand Down
4 changes: 2 additions & 2 deletions server/src/routes/admin/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,8 @@ export function setupOrganizationRoutes(
// Add membership to the new org
await pool.query(
`INSERT INTO organization_memberships
(workos_user_id, workos_organization_id, email, first_name, last_name, role)
VALUES ($1, $2, $3, $4, $5, 'member')
(workos_user_id, workos_organization_id, email, first_name, last_name)
VALUES ($1, $2, $3, $4, $5)
ON CONFLICT (workos_user_id, workos_organization_id)
DO UPDATE SET email = EXCLUDED.email, first_name = EXCLUDED.first_name, last_name = EXCLUDED.last_name`,
[userId, orgId, user.email, user.first_name, user.last_name]
Expand Down