Skip to content

Commit

Permalink
fix: sanitize backgroun modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Nov 27, 2020
1 parent 8ef57fb commit c1f3fb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/providers/cloudinary/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const operationsGenerator = createOperationsGenerator({
thumbnail: 'thumb',
cropping: 'crop',
coverLimit: 'limit'
},
background (value) {
if (value.startsWith('#')) {
return value.replace('#', 'rgb_')
}
return value
}
},
joinWith: ',',
Expand Down
8 changes: 8 additions & 0 deletions src/providers/local/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const operationsGenerator = createOperationsGenerator({
quality: 'q',
background: 'b'
},
valueMap: {
background (value) {
if (value.startsWith('#')) {
return value.replace('#', 'hex_')
}
return value
}
},
joinWith: ',',
formatter: (key, value) => `${key}_${value}`
})
Expand Down

0 comments on commit c1f3fb4

Please sign in to comment.