Skip to content

Incorrect action.type parenthesis matching on note creation #292

@VolatileDream

Description

@VolatileDream

Essentially the same issue as #276, but when not in templater mode. While #277 fixed the issue by processing action.type differently, the issue appears to stem from the use of the path matching regex which will eagerly match a parenthesis in the note name.

For example, given this button:

name Paren Test
type note(a () file) text
action

Is expected to create a file: a () file.md, but instead creates a (.md.

This incorrect parenthesis matching also affects the open options, as any open option is past the end of the match and ignored.

Given this button, we'd expect it to not open the file, but it defaults to opening it.

name Parens & Open
type note(a () file, false) text
action

Reproduced in version 0.9.13.


I don't know what sort of backwards compatibility concerns there might be with changing the regex. If it's guaranteed that the text, note, and other type declarations are always at the start or end of the string, it could be possible to prune the type string as it gets processed. And then the regex could be made to match the entire string.

eg: text note(...) or note(...) text -> note(...) -> (...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions