Skip to content

Commit

Permalink
fix: clamp image dimensions to min and max
Browse files Browse the repository at this point in the history
When we render on our side, the full image should still be captured.
  • Loading branch information
wwilsman committed Jan 31, 2020
1 parent 06df6ff commit d16183f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/image-snapshot-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ export default class ImageSnapshotService extends PercyClientService {
): Promise<any> {
return this.percyClient.createSnapshot(this.buildId, resources, {
name,
widths: [width],
minimumHeight: height,
// clamp between 10px - 2000px
widths: [Math.max(10, Math.min(width, 2000))],
minimumHeight: Math.max(10, Math.min(height, 2000)),
clientInfo: 'percy-upload',
}).then(async (response: any) => {
await this.percyClient.uploadMissingResources(this.buildId, response, resources)
Expand Down

0 comments on commit d16183f

Please sign in to comment.