Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

code improvements

Pedro Ladeira8ef8fb7880b0
diff --git a/apps/web/lib/qr/api.tsx b/apps/web/lib/qr/api.tsx
index e43468f36b..04f60c4741 100644
--- a/apps/web/lib/qr/api.tsx
+++ b/apps/web/lib/qr/api.tsx
@@ -40,13 +40,10 @@ export async function getQRAsSVG(props: QRPropsSVG): Promise<string> {
let image = "";
if (imageSettings != null && calculatedImageSettings != null) {
- if (calculatedImageSettings.excavation != null) {
- cells = excavateModules(cells, calculatedImageSettings.excavation);
- }
-
try {
const base64Image = await fetch(
`https://wsrv.nl/?url=${encodeURIComponent(imageSettings.src)}&w=100&h=100&encoding=base64`,
+ { signal: AbortSignal.timeout(5_000) },
).then((res) => {
if (!res.ok) {
throw new Error(`Failed to fetch logo: ${res.status}`);
@@ -54,6 +51,10 @@ export async function getQRAsSVG(props: QRPropsSVG): Promise<string> {
return res.text();
});
+ if (calculatedImageSettings.excavation != null) {
+ cells = excavateModules(cells, calculatedImageSettings.excavation);
+ }
+
image = [
`<image href="${base64Image}"`,
`height="${calculatedImageSettings.h}"`,