Skip to content

Commit 137ee63

Browse files
committed
fix(flyimg): encode all # characters in color values
1 parent 6323e51 commit 137ee63

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/runtime/providers/flyimg.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ const operationsGenerator = createOperationsGenerator({
102102
mozjpeg: Number,
103103
preserveAspectRatio: Number,
104104
preserveNaturalSize: Number,
105-
// Encode colours so # does not break the URL path segment
106-
background: (value: string) => value.startsWith('#') ? value.replace('#', '%23') : value,
107-
textColor: (value: string) => value.startsWith('#') ? value.replace('#', '%23') : value,
108-
textBackground: (value: string) => value.startsWith('#') ? value.replace('#', '%23') : value,
105+
// Encode # so it does not break the URL path segment
106+
background: (value: string) => value.replaceAll('#', '%23'),
107+
textColor: (value: string) => value.replaceAll('#', '%23'),
108+
textBackground: (value: string) => value.replaceAll('#', '%23'),
109109
// Encode text watermarks
110110
text: (value: string) => encodeURIComponent(value),
111111
},

0 commit comments

Comments
 (0)