Skip to content

Bug: plenary.filetype module overwrites fs_access = false option with default value #652

@dereklam-bond

Description

@dereklam-bond

Issue

There's a bug in lua/plenary/filetype.lua where if you explicitly pass fs_access = false as an option, it gets overwritten with the default value true. This causes text matches to be converted to "" when the filepath exists.

Current behavior

In the code at line 161:

opts.fs_access = opts.fs_access or true

This expression will always set opts.fs_access to true if its current value is false.

Expected behavior

The code should only set the default value if opts.fs_access is nil (unspecified), not when it's explicitly set to false.

Proposed fix

Change line 161 to:

opts.fs_access = (opts.fs_access == nil and true) or opts.fs_access

fs_access only gets the default value of true when it hasn't been specified, preserving any explicitly set value including false.

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