mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 00:03:27 +10:00
Merge pull request #1717 from SergejKasper/fix-linkedIn-import-fails
fix(import): LinkedIn Profile.csv parsing fixes
This commit is contained in:
@ -11,7 +11,7 @@ import {
|
|||||||
ResumeData,
|
ResumeData,
|
||||||
resumeDataSchema,
|
resumeDataSchema,
|
||||||
} from "@reactive-resume/schema";
|
} from "@reactive-resume/schema";
|
||||||
import { extractUrl, Json, parseCSV } from "@reactive-resume/utils";
|
import { extractUrl, Json, parseArrayLikeCSVEntry, parseCSV } from "@reactive-resume/utils";
|
||||||
import * as JSZip from "jszip";
|
import * as JSZip from "jszip";
|
||||||
import { Schema } from "zod";
|
import { Schema } from "zod";
|
||||||
|
|
||||||
@ -64,16 +64,21 @@ export class LinkedInParser implements Parser<JSZip, LinkedIn> {
|
|||||||
result.basics.name = `${profile["First Name"]} ${profile["Last Name"]}`;
|
result.basics.name = `${profile["First Name"]} ${profile["Last Name"]}`;
|
||||||
result.basics.location = profile["Geo Location"];
|
result.basics.location = profile["Geo Location"];
|
||||||
result.basics.headline = profile.Headline;
|
result.basics.headline = profile.Headline;
|
||||||
result.basics.url.href = extractUrl(profile.Websites) ?? "";
|
// profile.Websites is represented as an array-like structure f.e. [COMPANY:https://some.link,PORTFOLIO:...]
|
||||||
|
const extractFirstWebsiteLink = (entry: string) =>
|
||||||
|
(parseArrayLikeCSVEntry(entry)[0] ?? "").replace(/.*?:/, "");
|
||||||
|
result.basics.url.href = extractUrl(extractFirstWebsiteLink(profile.Websites)) ?? "";
|
||||||
result.sections.summary.content = profile.Summary;
|
result.sections.summary.content = profile.Summary;
|
||||||
result.sections.profiles.items.push({
|
if (twitterHandle) {
|
||||||
...defaultProfile,
|
result.sections.profiles.items.push({
|
||||||
id: createId(),
|
...defaultProfile,
|
||||||
icon: "twitter",
|
id: createId(),
|
||||||
network: "Twitter",
|
icon: "twitter",
|
||||||
username: twitterHandle,
|
network: "Twitter",
|
||||||
url: { ...defaultProfile.url, href: `https://twitter.com/${twitterHandle}` },
|
username: twitterHandle,
|
||||||
});
|
url: { ...defaultProfile.url, href: `https://twitter.com/${twitterHandle}` },
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Email Addresses
|
// Email Addresses
|
||||||
|
|||||||
@ -12,3 +12,11 @@ export const parseCSV = async (string: string) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parser for cases when we receive an array like structure f.e. a in the LinkedIn Profile.csv import
|
||||||
|
* @param csvEntry array-like entry such as [TAG:https://some.link,TAG:https://someother.link]
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const parseArrayLikeCSVEntry = (csvEntry: string) =>
|
||||||
|
csvEntry.replace(/^\[/, "").replace(/$\]/, "").split(",");
|
||||||
|
|||||||
Reference in New Issue
Block a user