Skip to content

Commit 28411a9

Browse files
Merge remote-tracking branch 'upstream/main' into chore/pull-in-upstream-changes
# Conflicts: # package.json # src/processing/svg.ts
2 parents c47bc0c + d9920cc commit 28411a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/processing/svg.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { BadgePreset, ContribkitRenderOptions, ImageFormat, Sponsor, Sponsorship } from '../types'
2+
import crypto from 'node:crypto'
23
import { resizeImage } from './image'
34

4-
let id = 0
55
export function genSvgImage(
66
x: number,
77
y: number,
@@ -10,7 +10,7 @@ export function genSvgImage(
1010
base64Image: string,
1111
imageFormat: ImageFormat,
1212
) {
13-
const cropId = `c${id++}`
13+
const cropId = `c${crypto.createHash('md5').update(base64Image).digest('hex').slice(0, 6)}`
1414
return `
1515
<clipPath id="${cropId}">
1616
<rect x="${x}" y="${y}" width="${size}" height="${size}" rx="${size * radius}" ry="${size * radius}" />

0 commit comments

Comments
 (0)