Skip to content

allowedExtensions does not recognize jsonl files #1903

@ethicnology

Description

@ethicnology

Describe the bug
allowedExtensions doesn't work if the input is jsonl while it works fine for json

Platform

  • Android
  • iOS
  • Web (not tested)
  • Desktop (not tested)

Platform OS version

  • iPhone 16 Pro Max with iOS 18.1
  • Pixel 9 with Android 15

How are you picking?

    final fileContent = await _fileSystemRepository.pickFile(
      extensions: ['jsonl'], // FilePicker doesn't seems to support jsonl files
    );



  Future<File> pickFile({List<String>? extensions}) async {
    final result = await FilePicker.platform.pickFiles(
      allowedExtensions: extensions,
      type: extensions != null ? FileType.custom : FileType.any,
    );
    if (result != null) return File(result.files.single.path!);

    throw FileStorageException('File not selected');
  }

Screenshots and/or video

Image

Flutter Version details
flutter 3.29.3 & file_picker 10.3.3

Additional context
saveFile function, the extension is specified in the filename, it works fine with json but not jsonl

  Future<void> saveFile(String content, String filename) async {
    final bytes = utf8.encode(content);
    final result = await FilePicker.platform.saveFile(
      bytes: bytes,
      fileName: filename,
    );

    if (result == null) throw FileStorageException('File not saved');
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    new issueAn issue that hasn't yet been seen from the maintainer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions