Skip to content

Add: blacklist in transform, fix env issue in single download#401

Merged
eight04 merged 3 commits intomasterfrom
dev-transform-blacklist
Jan 30, 2026
Merged

Add: blacklist in transform, fix env issue in single download#401
eight04 merged 3 commits intomasterfrom
dev-transform-blacklist

Conversation

@eight04
Copy link
Copy Markdown
Owner

@eight04 eight04 commented Jan 30, 2026

Fixes #392

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a blacklist feature to exclude unwanted images from the image picker by using URL transform rules, and fixes an environment handling issue in the single download functionality.

Changes:

  • Added blacklist functionality to URL transform rules where setting replacement to "-" excludes matching URLs
  • Fixed missing expandEnv call in singleDownload function
  • Fixed ext property handling to include dot prefix consistently

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/lib/url-map.js Implements blacklist logic by returning empty string when replacement is "-"
src/lib/image-util.js Adds transformURL check in isImage to filter blacklisted images
src/content.js Filters out blacklisted URLs (empty strings) in getImages
src/picker.js Fixes ext property to include dot prefix for consistency
src/background.js Adds missing expandEnv call and fixes ext property in singleDownload
README.md Documents the new blacklist feature with examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

base: image.data && image.data.filename,
alt: image.alt,
ext: image.data && image.data.ext
ext: image.data?.ext ? `.${image.data.ext}` : null
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

For consistency with the rest of the codebase and with background.js line 638, consider using undefined instead of null as the fallback value when ext is not available. This maintains consistency with how other optional properties (like base and alt) are handled.

Suggested change
ext: image.data?.ext ? `.${image.data.ext}` : null
ext: image.data?.ext ? `.${image.data.ext}` : undefined

Copilot uses AI. Check for mistakes.
Comment on lines +111 to +113
if (node.src && !transformURL(node.src)) {
return false;
}
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

This blacklist check in isImage prevents extraction of valid URLs from elements that have a blacklisted src attribute. For example, if an img element has a blacklisted thumbnail in src but a valid full-size image in srcset, the entire element will be rejected and the srcset URL will never be extracted. The blacklist filtering should only happen during URL extraction in content.js (lines 86-88) where individual URLs are filtered, not at the element level. Remove this check from isImage.

Suggested change
if (node.src && !transformURL(node.src)) {
return false;
}

Copilot uses AI. Check for mistakes.
@eight04 eight04 merged commit a21a696 into master Jan 30, 2026
1 check passed
@eight04 eight04 deleted the dev-transform-blacklist branch January 30, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REQUEST: add blacklist option for picker

2 participants