Skip to content

ImageKit aspectRatio param double encoding #195

@maybephilipp

Description

@maybephilipp

ImageKit operation for aspectRatio (ar) url-encodes value twice.

Input:

{
  imagekit: {
    ar: '9-16'
  }
}

Output: https://ik.imagekit.io/image.png?updatedAt=1778956861259&tr=ar-9%252D16%2Cfo-custom%2Cw-640%2Cc-maintain_ratio

You can see ar-9%252D16 which is:

decodeURIComponent(decodeURIComponent('ar-9%252D16')) === 'ar-9-16'  // true
decodeURIComponent('ar-9%252D16') !== 'ar-9-16'  // false – 'ar-9%2D16'

This breaks ImageKit's aspect ratio functionality.

P.S. Yes, correct syntax for aspect ratio in ImageKit is dashed, not semicolon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions