diff options
| author | Dhravya <[email protected]> | 2024-04-11 19:33:59 -0700 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-04-11 19:33:59 -0700 |
| commit | bb98d22f7ab1116e2817dc7a96b2343dea97cd08 (patch) | |
| tree | cfabadb99fc78c4bb343a18078b3df69d306c290 /apps/web/src | |
| parent | spaces not showing bug fixed (diff) | |
| download | supermemory-bb98d22f7ab1116e2817dc7a96b2343dea97cd08.tar.xz supermemory-bb98d22f7ab1116e2817dc7a96b2343dea97cd08.zip | |
properly show ids
Diffstat (limited to 'apps/web/src')
| -rw-r--r-- | apps/web/src/lib/utils.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index 4f34e990..f7e6d3be 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -19,8 +19,14 @@ export function cleanUrl(url: string) { } export function getIdsFromSource(sourceIds: string[]) { - // This function converts an id from a form of `websiteURL-userID` to just the websiteURL - return sourceIds.map((id) => id.split("-").slice(0, -1).join("-")); + return sourceIds.map((id) => { + const parts = id.split("-"); + if (parts.length > 1) { + return parts.slice(0, -1).join("-"); + } else { + return id; + } + }); } export function generateId() { |