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

feat(common): permit data and blob URLs in ngSrc attribute #55878

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

paulyy-y
Copy link

The src attribute supports blob and data URLs, and allowing the same behavior for ngSrc doesn't have any visible negative effects from my initial tests. Since there is no documented rationale for this, either in the original commit or official docs, I am assuming this is not a needed restriction and can be considered an unnecessary regression.

NOTE: If this restriction was to be required, both documentation and linters should be updated accordingly. Various IDE's now assume Angular projects should use ngSrc as a "drop-in" replacement for src now, and will recommend that users change their attributes accordingly.

This reverts commit 801daf8.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Blocks usage of blob: or data: URL's in ngSrc.

Issue Number: #55762

What is the new behavior?

Permits usage.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The `src` attribute supports blob and data URLs, and allowing the same
behavior for `ngSrc` doesn't have any visible negative
effects from my initial tests. Since there is no documented rationale
for this, either in the original commit or official docs, I am assuming
this is not a needed restriction and can be considered a regression.

NOTE: If this restriction _was_ to be required, both documentation and
linters should be updated accordingly. Various IDE's now assume Angular
projects should use `ngSrc` as a replacement for `src` now, and will
inform users of that.

This reverts commit 801daf8.
@pullapprove pullapprove bot requested a review from atscott May 19, 2024 17:12
@paulyy-y paulyy-y changed the title revert: fix(common): detect data: and blob: inputs in NgOptimizedImage feat(common): permit data and blob URLs in ngSrc attribute May 20, 2024
@dylhunn dylhunn added area: common Issues related to APIs in the @angular/common package common: image directive labels May 22, 2024
@ngbot ngbot bot modified the milestone: Backlog May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: common Issues related to APIs in the @angular/common package common: image directive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants