Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix the buffer warning

Manav Rathi3cde395f42fa
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 8a347eec00..0721bf648a 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -1223,11 +1223,10 @@ const PublicShare: React.FC<PublicShareProps> = ({
useEffect(() => {
if (publicShareProp?.url) {
- const url = appendCollectionKeyToShareURL(
+ appendCollectionKeyToShareURL(
publicShareProp.url,
collection.key,
- );
- setPublicShareUrl(url);
+ ).then((url) => setPublicShareUrl(url));
} else {
setPublicShareUrl(null);
}
diff --git a/web/packages/gallery/services/share.ts b/web/packages/gallery/services/share.ts
index 3429dee3aa..fbb5e6d8f8 100644
--- a/web/packages/gallery/services/share.ts
+++ b/web/packages/gallery/services/share.ts
@@ -1,4 +1,4 @@
-import { fromHex, toB64 } from "@/base/crypto";
+import { fromB64, fromHex, toB64 } from "@/base/crypto";
import bs58 from "bs58";
/**
@@ -18,13 +18,13 @@ import bs58 from "bs58";
* @returns A URL that includes the base-58 encoded collection key as the hash
* fragment.
*/
-export const appendCollectionKeyToShareURL = (
+export const appendCollectionKeyToShareURL = async (
url: string,
collectionKey: string,
) => {
const sharableURL = new URL(url);
- const bytes = Buffer.from(collectionKey, "base64");
+ const bytes = await fromB64(collectionKey);
sharableURL.hash = bs58.encode(bytes);
return sharableURL.href;
};