Skip to content

[Bug] CLI export only replaces first %document_path% placeholder in target path #496

@lxymahatma

Description

@lxymahatma

When exporting files, if the target pattern contains %document_path% more than once, only the first occurrence is replaced. The remaining occurrences stay as a literal string.

Example config:

{
  "files": [
    {
      "format": "resx_2_0",
      "source": "**/*.resx",
      "target": "%document_path%/%document_path%.%slug%.resx"
    }
  ]
}

Expected behavior

All occurrences of %document_path% should be replaced, for example:
.../Description/Description.de.resx

Actual behavior

Generated filename contains a literal placeholder in the second position, for example:
.../Description/%document_path%.de.resx

Notes

Likely related code:

const parsedTarget = document.target
.replace('%slug%', pseudoLanguageName)
.replace('%original_file_name%', path)
.replace('%document_path%', path);
const parsedTarget = document.target
.replace('%slug%', slug)
.replace('%original_file_name%', path)
.replace('%document_path%', path);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions