Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly handle a false value for the parseImgDimensions option #985

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

paviad
Copy link

@paviad paviad commented Jul 11, 2023

Contains two fixes:

  1. Change the default value of the parseImgDimensions option to true (also in documentation)
  2. Properly reject image dimensions when the option is set to false

Closes #984

Copy link

@joshiayush joshiayush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add options.parseImgDimensions down in the if clause:

    if (options.parseImgDimensions && width && height) {
      width  = (width === '*') ? 'auto' : width;
      height = (height === '*') ? 'auto' : height;
      result += ' width="' + width + '"';
      result += ' height="' + height + '"';
    }

Look, the desired behaviour should be this.

src/subParsers/makehtml/images.js Outdated Show resolved Hide resolved
@codeclimate
Copy link

codeclimate bot commented Jul 18, 2023

Code Climate has analyzed commit 456a6f7 and detected 0 issues on this pull request.

View more on Code Climate.

@paviad
Copy link
Author

paviad commented Jul 18, 2023

Resolved all issues, new behavior will not reject dimensions, but will simply ignore them.

Copy link

@joshiayush joshiayush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR fixes #984 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants