Skip to content

Commit 866379d

Browse files
chore: pull in upstream changes v16.4.2 (#5)
* fix: deterministic crop id (antfu-collective#110) * chore: release v16.4.2 --------- Co-authored-by: Hiroki Osame <[email protected]>
1 parent c47bc0c commit 866379d

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)