Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix image-minimizer on lines containing multiple images #11879

Merged

Conversation

tom93
Copy link
Contributor

@tom93 tom93 commented Jan 4, 2025

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)
  • Bugfix (dev facing)

Description of the changes in your PR

It is legal to have multiple images on a single line in Markdown. The previous regex did not handle that correctly. This PR fixes the regex.

Fixes the following issue(s)

  • (Not tracked)

Testing

var exampleBody = "![image-1](https://x.githubusercontent.com/1/11111111111111111111111111111111.png) ![image-2](https://x.githubusercontent.com/2/22222222222222222222222222222222.png)";
await replaceAsync(exampleBody, REGEX_USER_CONTENT_IMAGE_LOOKUP, match => `<<${match}>>`);
// previous output (incorrect):
"<<![image-1](https://x.githubusercontent.com/1/11111111111111111111111111111111.png) ![image-2](https://x.githubusercontent.com/2/22222222222222222222222222222222.png)>>"
// output with the fix:
"<<![image-1](https://x.githubusercontent.com/1/11111111111111111111111111111111.png)>> <<![image-2](https://x.githubusercontent.com/2/22222222222222222222222222222222.png)>>" 

APK testing

N/A

Due diligence

@github-actions github-actions bot added the size/small PRs with less than 50 changed lines label Jan 4, 2025
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thank you!

@Stypox Stypox merged commit f7d0fd5 into TeamNewPipe:dev Jan 4, 2025
1 check passed
@tom93 tom93 deleted the pr/fix-image-minimizer-multiple-images branch January 4, 2025 10:50
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
size/small PRs with less than 50 changed lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants