Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix partial percent encoded links in markdown images #1572

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/shared/common_markdown_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import 'package:markdown/markdown.dart' as md;
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

import 'package:thunder/shared/text/scalable_text.dart';
import 'package:thunder/utils/colors.dart';

import 'package:thunder/utils/media/image.dart';
import 'package:thunder/utils/links.dart';
import 'package:thunder/shared/image_preview.dart';
Expand Down Expand Up @@ -120,6 +120,8 @@ class CommonMarkdownBody extends StatelessWidget {
imageBuilder: (uri, title, alt) {
if (hideContent) return Container();

String decodedUri = Uri.decodeFull(uri.toString());

return FutureBuilder(
future: isImageUriSvg(uri),
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
Expand All @@ -130,7 +132,7 @@ class CommonMarkdownBody extends StatelessWidget {
children: [
snapshot.data != true
? ImagePreview(
url: uri.toString(),
url: decodedUri,
isExpandable: true,
isComment: isComment,
showFullHeightImages: true,
Expand Down
Loading