Skip to content

PR to improve the hash function for uuid #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 5, 2023
Merged
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
4 changes: 3 additions & 1 deletion functions/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,21 @@ export async function getZip_Uid(data) {
const zip = new JSZip()
const code = data.code
const template = `ignite-${data.template}`
let fullCode = ''

// As usual from Download component,
// we will zip the files and
// generate a base64 format for pushing to GitHub
// with Octokit.
for (const filename in code) {
fullCode += code[filename]
zip.file(filename, code[filename])
}
// since the generated zip varies every time even with the same code
// it can't be used to generate a UUID
const content = await zip.generateAsync({ type: 'base64' })
// we generate an unique id from the current config for pushing to github
const nbUid = uuidv5(JSON.stringify(data.config), uuidv5.URL)
const nbUid = uuidv5(fullCode, uuidv5.URL)
const zipRes = await pushToGitHub(content, `${template}.zip`, nbUid)
return {
zipRes: zipRes,
Expand Down