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

Support remote images with encoded characters #9540

Merged
merged 3 commits into from
Dec 28, 2023
Merged

Support remote images with encoded characters #9540

merged 3 commits into from
Dec 28, 2023

Conversation

matthewp
Copy link
Contributor

Changes

Testing

  • Test added

Docs

N/A, bug fix

Copy link

changeset-bot bot commented Dec 28, 2023

🦋 Changeset detected

Latest commit: e11e196

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Dec 28, 2023
@github-actions github-actions bot added the pr: docs A PR that includes documentation for review label Dec 28, 2023
@@ -10,7 +10,7 @@ export function propsToFilename(transform: ImageTransform, hash: string) {
isESMImportedImage(transform.src) ? transform.src.src : transform.src
);
const ext = extname(filename);
filename = basename(filename, ext);
filename = decodeURIComponent(basename(filename, ext));
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, while this does fix the problem I'm sure, I wonder what kind of filepath does it generate? Doesn't that mean that for non-encoded slashes it would generate nested directories?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A non-encoded slash would be removed in the basename() operation.

Copy link
Member

Choose a reason for hiding this comment

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

Oh yeah, that's true. Awesome then!

Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

Looks good!

@matthewp matthewp merged commit 7f212f0 into main Dec 28, 2023
@matthewp matthewp deleted the encoded-url branch December 28, 2023 20:08
@astrobot-houston astrobot-houston mentioned this pull request Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Astro Image remote url is not working with Firebase Storage
3 participants