Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3401068
D10310.id34621.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10310.id34621.diff
View Options
diff --git a/native/expo-modules/comm-expo-package/android/src/main/java/app/comm/android/thumbhash/ThumbhashModule.kt b/native/expo-modules/comm-expo-package/android/src/main/java/app/comm/android/thumbhash/ThumbhashModule.kt
--- a/native/expo-modules/comm-expo-package/android/src/main/java/app/comm/android/thumbhash/ThumbhashModule.kt
+++ b/native/expo-modules/comm-expo-package/android/src/main/java/app/comm/android/thumbhash/ThumbhashModule.kt
@@ -53,7 +53,7 @@
val rgba = bitmap.toRGBA()
val thumbHash = ThumbHash.rgbaToThumbHash(bitmap.width, bitmap.height, rgba)
- return Base64.encodeToString(thumbHash, Base64.DEFAULT)
+ return Base64.encodeToString(thumbHash, Base64.NO_WRAP)
}
// endregion
diff --git a/native/utils/thumbhash-module.js b/native/utils/thumbhash-module.js
--- a/native/utils/thumbhash-module.js
+++ b/native/utils/thumbhash-module.js
@@ -7,12 +7,18 @@
+generateThumbHash: (photoURI: string) => Promise<string>,
} = requireNativeModule('Thumbhash');
+const newLineRegex = /\n/g;
async function generateThumbHash(photoURI: string): Promise<string> {
invariant(
platformUtilsModule.generateThumbHash,
'generateThumbHash() unavailable. Check if Thumbhash expo-module is autolinked',
);
- return await platformUtilsModule.generateThumbHash(photoURI);
+
+ const rawThumbHash = await platformUtilsModule.generateThumbHash(photoURI);
+
+ // Sometimes native base64 modules encode the string with newlines,
+ // which breaks the thumbhash format
+ return rawThumbHash.replace(newLineRegex, '');
}
export { generateThumbHash };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 10:16 AM (3 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611309
Default Alt Text
D10310.id34621.diff (1 KB)
Attached To
Mode
D10310: [native] Fix failing base64 decode for thumbhash
Attached
Detach File
Event Timeline
Log In to Comment