Skip to content

Commit 0e12cc3

Browse files
authored
feat: allowed multiple links (#77)
* feat: allowed multiple links * fix: date
1 parent 39b57bb commit 0e12cc3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/pages/api/projects/create.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ const validateTeamCode = async (team_code: string, errors: String[]) => {
9898
}
9999

100100
const validateLink = async (link: string, errors: String[]) => {
101+
const links = link.split(" ");
102+
103+
for (let i = 0; i < links.length; i++) {
104+
const link = links[i].trim();
105+
if (link.length > 0) {
106+
const valid = await validateGithubLink(link, errors);
107+
if (!valid) {
108+
return false;
109+
}
110+
}
111+
}
112+
113+
return true;
114+
}
115+
116+
const validateGithubLink = async (link: string, errors: String[]) => {
101117
const githubLinkRegex = /^https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/;
102118

103119
const match = link.match(githubLinkRegex);

0 commit comments

Comments
 (0)