Skip to content

Commit

Permalink
fix: avatar image crossorigin
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Oct 3, 2024
1 parent f7da83a commit 5b01638
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-comics-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

fix: ensure `crossorigin` isn't applied to image if it is `undefined` or not passed as a prop
2 changes: 1 addition & 1 deletion packages/bits-ui/src/lib/bits/avatar/avatar.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AvatarRootState {
const image = new Image();

image.src = src;
if (crossorigin) image.crossOrigin = crossorigin;
if (crossorigin !== undefined) image.crossOrigin = crossorigin;
if (referrerPolicy) image.referrerPolicy = referrerPolicy;

this.loadingStatus.current = "loading";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
child,
id = useId(),
ref = $bindable(null),
crossorigin = "",
crossorigin = undefined,
referrerpolicy = undefined,
...restProps
}: ImageProps = $props();
Expand Down
6 changes: 0 additions & 6 deletions sites/docs/src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import { buildDocsIndex } from "$lib/scripts/build-search.js";

export async function handle({ event, resolve }) {
const response = await resolve(event);

response.headers.set("Cross-Origin-Embedder-Policy", "require-corp");
response.headers.set("Cross-Origin-Opener-Policy", "same-origin");

return response;
}

0 comments on commit 5b01638

Please sign in to comment.