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

[NgOptimizedImage] Revert Assertions Against Blob and Data URL's or Document the Rationale #55762

Open
paulyy-y opened this issue May 11, 2024 · 1 comment
Labels
area: common Issues related to APIs in the @angular/common package common: image directive
Milestone

Comments

@paulyy-y
Copy link

Which @angular/* package(s) are relevant/related to the feature request?

common

Description

Commit 801daf8 added assertions against using blob: and data: URL's. for NgOptimizedImage.

I cannot find any reasoning provided in either the documentation for the NgOptimizedImage directive 1 2 nor in the source changes. The documentation makes it seem like 'ngSrc' is a drop-in-replacement for the src attribute with no warning or indication that there are significant regressions in functionality when using it as such. Note: IDE's such as JetBrains Webstorm actively lint against using src and suggest replacing it with ngSrc in Angular projects.

Removing these assertions shows expected behavior without any issues. So why was this introduced? Maybe there is a great reason for these changes... the commit description provides 0 insight and the error message asking users to simply stop using it is not a fantastic UX.

Proposed solution

Revert the commit and allow those inputs. Happy to do a PR but would like confirmation that there isn't some special reasons for this constraint first.

Alternatives considered

Add documentation to:

  1. The directive documentation outlining there are clear caveats and regressions going from ngSrc to src.
  2. The source logic indicating why these assertions are needed (a simple one liner like // These types conflict with Foo logic, so we prevent them from being used helps posterity tremendously).
@pkozlowski-opensource pkozlowski-opensource added the area: common Issues related to APIs in the @angular/common package label May 15, 2024
@ngbot ngbot bot added this to the needsTriage milestone May 15, 2024
@rudyhadoux
Copy link

rudyhadoux commented May 27, 2024

Hi, AWS Amplify uses S3 pre-signed image URLs.
Why it is rejected as invalid value ?

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

No branches or pull requests

4 participants