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

CacheManager attempts to create file named guid.* on Windows (full example included and clear description)

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
dart, flutter
領域
desktop

調査の方向性

疑わしいロジックは lib/src/web/file_service.dart の 115 行目付近にあります。まず、提供されている最小再現を Windows で実行し、content-type ヘッダーがキャッシュのファイル名の拡張子になるまでの流れを追跡してください。ヘッダーに使用可能な拡張子がないダウンロードで Windows で有効なファイル名が作成され、通常の拡張子が引き続き機能すれば完了です。

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

説明

🐛 Bug Report

While downloading an image from a webserver the cache manager decides to create a filename ending with .* which is not permitted on windows.

Expected behavior

Create a filename without extension or a generic extension like .cache or .file since the cache manager cannot determine it from the webserver headers.

Reproduction steps

i have made minimal reproducible example no external dependencies needed (other than http package)
i am aware that the server should provide correct descriptive headers for the content being served but sometimes it happens not to in some scenarios.

import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:http/http.dart' as http;
import 'package:http/testing.dart';

Future<void> main() async {
  final client = MockClient((http.Request request) async =>
      http.Response("a png image", 200, headers: {
        "content-type": "application/*",
        "content-disposition":
            "attachment; filename=file; filename*=UTF-8''file"
      }));

  final cmgr = CacheManager(Config(DefaultCacheManager.key,
      fileService: HttpFileService(httpClient: client)));

/* crashes with
  Launching lib\main.dart on Windows in debug mode...
  √  Built build\windows\runner\Debug\cache_mgr_test.exe.
  [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FileSystemException: Cannot open file, path = 'C:\Users\csman\AppData\Local\Temp\libCachedImageData\cf09f070-6cef-1d8a-b096-2334712b3134.*' (OS Error: The filename, directory name, or volume label syntax is incorrect.

  , errno = 123)
  #0      _checkForErrorResponse (dart:io/common.dart:55:9)
  #1      _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)
  <asynchronous suspension>
*/

  await cmgr.downloadFile("http://myaddress.com/imageManager?pngfileid=1234");
}

/*
pubspec.yaml 

name: cache_mgr_test
description: A new Flutter project.
publish_to: "none"
version: 1.0.0+1
environment:
  sdk: ">=3.1.5 <4.0.0"
dependencies:
  cupertino_icons: ^1.0.2
  flutter:
    sdk: flutter
  flutter_cache_manager: ^3.3.1
  http: ^1.1.0
dev_dependencies:
  flutter_lints: ^2.0.0
  flutter_test:
    sdk: flutter
flutter:
  uses-material-design: true
*/

Configuration

Version: 3.3.1

Platform:
Windows 10

I think the problematic part is in \flutter_cache_manager-3.3.1\lib\src\web\file_service.dart line 115 around

  @override
  String get fileExtension {
    var fileExtension = '';
    final contentTypeHeader = _header(HttpHeaders.contentTypeHeader);
    if (contentTypeHeader != null) {
      final contentType = ContentType.parse(contentTypeHeader);
      fileExtension = contentType.fileExtension;
    }
    return fileExtension;
  }
主要言語
Dart
スター
810
フォーク
510
平均マージ
2日 2時間
マージ済み PR(30日)
11

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

Baseflow/flutter_cache_manager のほかの issue

Baseflow/flutter_cache_manager の issue をすべて見る

似ている issue

Dart の issue をもっと見る

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

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