android still failed, edit regex so that // in ipfs://cid are optional and ipfs:cid is also valid.
This commit is contained in:
1 parent
ec92ca7563
commit
f9465cc4d0
3 files changed
+13
-2
No files matched your search
@@ -20,7 +20,7 @@ pluginManagement {
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "8.11.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
|
||||
}
|
||||
|
||||
include(":app")
|
||||
@@ -27,7 +27,7 @@ class MessageUrlImageHelper {
|
||||
);
|
||||
|
||||
static final RegExp _ipfsCidPattern = RegExp(
|
||||
r'''ipfs://([^\s<>'"`]+)''',
|
||||
r'''ipfs:(?://)?([^\s<>'"`]+)''',
|
||||
caseSensitive: false,
|
||||
);
|
||||
|
||||
|
||||
@@ -45,6 +45,17 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('parses direct ipfs cid urls without double slashes', () async {
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
'my picture: ipfs:bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
);
|
||||
|
||||
expect(
|
||||
attachment,
|
||||
'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly',
|
||||
);
|
||||
});
|
||||
|
||||
test('parses http image urls', () async {
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
'see this image https://example.com/picture.png?size=large additional text',
|
||||
|
||||
Reference in new issue
Block a user