Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Firebase Storage + Flutter Web] Failed to detect image file format using the file header

オープン
#968 コメント 0 件 リアクション 4 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
dart, firebase, flutter
領域
cloud, web-dev

調査の方向性

レポートのエントリポイントは CachedNetworkImage、FirebaseHttpFileService、CustomCacheManager です。まず Flutter Web で相対 Firebase Storage URL を再現し、完全修飾された HTTPS URL と比較してください。相対パスが有効なヘッダー付きの画像バイトを返し、ImageCodecException なしでレンダリングされれば完了です。表示されているバージョンで検証してください。

索引モデルが issue の本文から書いたものです。

説明

🐛 Bug Report

When I try to load an image with "CachedNetworkImage()" I get the following error and the image can't be visualized:

ImageCodecException: Failed to detect image file format using the file header.
File header was [0x3c 0x21 0x44 0x4f 0x43 0x54 0x59 0x50 0x45 0x20].
Image source: http://localhost:49430/Shop/hHtD0QEuS2NkzWvSTUOZ/computer2.png

  • The problem only appears in Flutter Web with relative URIs from Firebase Storage (fileService: FirebaseHttpFileService() is used).
  • The same code works for iOS/Android.
  • In the console of Firebase Storage I see that the image has the correct MIME-type "image/jpeg".
  • All images which I tested (.png / .jpeg) have this problem.
  • Using -web-renderer html doesn't solve the problem.
  • If I use CachedNetworkImage() for the same picture from Firebase Storage with a fully qualified https-URL (instead of using FirebaseHttpFileService) then the picture is visualized correctly in Flutter Web.
Expected behavior

CachedNetworkImage should be able to visualize Firebase Storage pictures when using fileService: FirebaseHttpFileService() with relative paths.

Reproduction steps
CachedNetworkImage(
                  imageUrl: 'Shop/hHtD0QEuS2NkzWvSTUOZ/computer2.png',
                  placeholder: (context, url) => Center(child: customCircularProgressIndicator()),
                  errorWidget: (context, url, error) {
                    print(error);
                    return const Icon(Icons.close, color: MyColors.error);
                  },
                  cacheManager: CustomCacheManager(),
                ),

"imageUrl" is a relative path inside Firebase Storage.

class CustomCacheManager extends CacheManager {
  static const key = CKeys.customCacheManagerKey;

  static final CustomCacheManager _instance = CustomCacheManager._internal();

  CustomCacheManager._internal()
      : super(
          Config(
            key,
            stalePeriod: const Duration(days: 1),
            fileService: FirebaseHttpFileService(),
          ),
        );

  factory CustomCacheManager() {
    return _instance;
  }
}
Configuration

Version:
cached_network_image: 3.4.0
flutter_cache_manager_firebase: 2.1.1

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🖥️ Web
主要言語
Dart
スター
2.6k
フォーク
734
平均マージ
3日 10時間
マージ済み PR(30日)
14

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Baseflow/flutter_cached_network_image のほかの issue

Baseflow/flutter_cached_network_image の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。