Skip to content

Fix case-sensitive file extension matching in PlainTextDecoder detection #372

@coderabbitai

Description

@coderabbitai

Problem

Currently, file type detection uses case-sensitive extension matching via fileName.endsWith(ext) without normalizing the filename to lowercase. This means files like "SERVER.LOG" won't be detected as Plain Text files on case-sensitive filesystems (Linux), while they would work on case-insensitive filesystems (Windows).

Expected Behavior

File extension matching should be case-insensitive across all platforms for consistent user experience.

Suggested Solution

Update tryCreateDecoderByExtension in src/services/LogFileManager/decodeUtils.ts to normalize the filename and/or extensions to lowercase before performing the endsWith check:

  • Use fileName.toLowerCase().endsWith(ext.toLowerCase())
  • Update any related extension comparison logic

Context

This issue was identified during review of PR #370 which adds PlainTextDecoder support.

Backlinks:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions