Keep the public IPFS gateway the user chose
Default to https://ipfs.io/ipfs/ like dev, keep saved gateways as they are, and keep an explicitly cleared gateway deactivated across restarts instead of rewriting public gateways to empty on every load.
This commit is contained in:
1 parent
c111835bd0
commit
ee302f647b
3 files changed
+37
-37
No files matched your search
@@ -48,23 +48,20 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'does not resolve ipfs cid links with the default gateway deactivated',
|
||||
() async {
|
||||
expect(
|
||||
await MessageUrlImageHelper.parse(
|
||||
'my picture: ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
expect(
|
||||
await MessageUrlImageHelper.parse(
|
||||
'my picture: ipfs:bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
},
|
||||
);
|
||||
test('resolves ipfs cid links with the default ipfs.io gateway', () async {
|
||||
expect(
|
||||
await MessageUrlImageHelper.parse(
|
||||
'my picture: ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
),
|
||||
'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly',
|
||||
);
|
||||
expect(
|
||||
await MessageUrlImageHelper.parse(
|
||||
'my picture: ipfs:bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
),
|
||||
'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly',
|
||||
);
|
||||
});
|
||||
|
||||
test('uses the configured public gateway for direct ipfs cid urls', () async {
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
|
||||
Reference in new issue
Block a user