Skip to content

Preset references ignore sanitize: false #77

Description

@CyR1en

Affected version

CommandPrompterPaper 3.1.1 and the current development branch (5534104).

Description

The sanitize property is loaded for every prompt preset type and is documented in schema/presets.schema.json, but <@preset_id> references always sanitize the submitted session answer. Setting "sanitize": false has no effect on final command substitution or post-command placeholders.

Steps to reproduce

  1. Add a Chat preset with sanitation disabled:

    {
      "type": "chat",
      "id": "raw_input",
      "prompt_text": "Enter text",
      "sanitize": false,
      "cancel": {
        "send": false,
        "message": "Cancel",
        "clickable": false,
        "hover_message": ""
      }
    }
  2. Reload and run a command such as:

    /say <@raw_input>
    
  3. Submit A&B or another value containing characters removed by session sanitation.

Expected behavior

With sanitize: false, the raw answer is preserved and /say A&B is dispatched.

Actual behavior

The final answer is sanitized (for example, A&B becomes AB) exactly as if sanitize were true.

Technical cause

CommandLineParser#parsePromptTag() creates every preset-reference PromptTag with sanitize = true.

PromptFactory#createFromTag() resolves the preset definition only for screen creation; it does not replace the session's parsed tag metadata. PromptSession#submitAnswer() therefore uses the hardcoded tag flag instead of PromptDefinition#sanitize().

Suggested direction

Resolve preset prompt metadata before the session starts, or otherwise propagate the resolved definition's sanitize value into the active session tag. Add coverage for sanitize: true and sanitize: false across preset prompt types.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions