@@ -14489,6 +14489,7 @@ function wrappy (fn, cb) {
1448914489
1449014490const axios = __nccwpck_require__(8757);
1449114491const { Octokit } = __nccwpck_require__(5375);
14492+ const path = __nccwpck_require__(1017);
1449214493
1449314494const COMMIT_MESSAGE = "Sync LeetCode submission";
1449414495const LANG_TO_EXTENSION = {
@@ -14535,7 +14536,10 @@ function pad(n) {
1453514536}
1453614537
1453714538function normalizeName(problemName) {
14538- return problemName.toLowerCase().replace(/\s/g, "-");
14539+ return problemName
14540+ .toLowerCase()
14541+ .replace(/\s/g, "-")
14542+ .replace(/[^a-zA-Z0-9_-]/gi, "");
1453914543}
1454014544
1454114545function graphqlHeaders(session, csrfToken) {
@@ -14628,7 +14632,7 @@ async function commit(params) {
1462814632 throw `Language ${submission.lang} does not have a registered extension.`;
1462914633 }
1463014634
14631- const prefix = !!destinationFolder ? `${ destinationFolder}/` : "";
14635+ const prefix = !!destinationFolder ? destinationFolder : "";
1463214636 const commitName = !!commitHeader ? commitHeader : COMMIT_MESSAGE;
1463314637
1463414638 if ("runtimePerc" in submission) {
@@ -14638,19 +14642,22 @@ async function commit(params) {
1463814642 message = `${commitName} Runtime - ${submission.runtime}, Memory - ${submission.memory}`;
1463914643 qid = "";
1464014644 }
14641- const questionPath = `${prefix}${qid}${name}/README.md`; // Markdown file for the problem with question data
14642- const solutionPath = `${prefix}${qid}${name}/solution.${
14643- LANG_TO_EXTENSION[submission.lang]
14644- }`; // Separate file for the solution
14645+ const folderName = `${qid}${name}`;
14646+ // Markdown file for the problem with question data
14647+ const questionPath = path.join(prefix, folderName, "README.md");
14648+
14649+ // Separate file for the solution
14650+ const solutionFileName = `solution.${LANG_TO_EXTENSION[submission.lang]}`;
14651+ const solutionPath = path.join(prefix, folderName, solutionFileName);
1464514652
1464614653 const treeData = [
1464714654 {
14648- path: questionPath,
14655+ path: path.normalize( questionPath) ,
1464914656 mode: "100644",
1465014657 content: questionData,
1465114658 },
1465214659 {
14653- path: solutionPath,
14660+ path: path.normalize( solutionPath) ,
1465414661 mode: "100644",
1465514662 content: `${submission.code}\n`, // Adds newline at EOF to conform to git recommendations
1465614663 },
@@ -14876,7 +14883,7 @@ async function sync(inputs) {
1487614883 }
1487714884
1487814885 offset += 20;
14879- } while (response.data.has_next );
14886+ } while (response.data.data.submissionList.hasNext );
1488014887
1488114888 // We have all submissions we want to write to GitHub now.
1488214889 // First, get the default branch to write to.
0 commit comments