Skip to content

Commit

Permalink
Fix image proxy thumbnails not retrieving image dimensions properly (#…
Browse files Browse the repository at this point in the history
…1522)

fix: thumbnails being proxied now retrieve dimensions correctly
  • Loading branch information
hjiangsu authored Aug 12, 2024
1 parent 68224aa commit ea5908f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/post/utils/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ Future<PostViewMedia> parsePostView(PostView postView, bool fetchImageDimensions
String? thumbnailUrl = postView.post.thumbnailUrl;
String? videoUrl = postView.post.embedVideoUrl;

// Handle thumbnail urls that are proxied via /image_proxy
Uri? thumbnailUri = Uri.tryParse(thumbnailUrl ?? '');

if (thumbnailUri?.path == '/api/v3/image_proxy') {
thumbnailUrl = thumbnailUri?.queryParameters['url'];
}

// First, check what type of link we're dealing with based on the url (MediaType.image, MediaType.video, MediaType.link, MediaType.text)
bool isImage = isImageUrl(url);
bool isVideo = isVideoUrl(videoUrl ?? url);
Expand Down

0 comments on commit ea5908f

Please sign in to comment.