forked from NYANDEV/forgejo
### Summary
Extend the template variable substitution to replace file paths. This
can be helpful for setting up log files & directories that should match
the repository name.
### PR Changes
- Move files matching glob pattern when setting up repos from template
- For security, added ~escaping~ sanitization for cross-platform support
and to prevent directory traversal (thanks @silverwind for the
reference)
- Added unit testing for escaping function
- Fixed the integration tests for repo template generation by passing
the repo_template_id
- Updated the integration testfiles to add some variable substitution &
assert the outputs
I had to fix the existing repo template integration test and extend it
to add a check for variable substitutions.
Example:
![image](
|
||
---|---|---|
.. | ||
actions | ||
packages | ||
_index.en-us.md | ||
_index.zh-cn.md | ||
_index.zh-tw.md | ||
agit-support.en-us.md | ||
agit-support.zh-cn.md | ||
authentication.en-us.md | ||
authentication.zh-cn.md | ||
authentication.zh-tw.md | ||
clone-filter.en-us.md | ||
clone-filter.zh-cn.md | ||
code-owners.en-us.md | ||
incoming-email.en-us.md | ||
incoming-email.zh-cn.md | ||
issue-pull-request-templates.en-us.md | ||
issue-pull-request-templates.zh-cn.md | ||
labels.en-us.md | ||
labels.zh-cn.md | ||
linked-references.en-us.md | ||
linked-references.zh-cn.md | ||
merge-message-templates.en-us.md | ||
merge-message-templates.zh-cn.md | ||
permissions.en-us.md | ||
permissions.zh-cn.md | ||
profile-readme.en-us.md | ||
profile-readme.zh-cn.md | ||
protected-tags.en-us.md | ||
protected-tags.zh-cn.md | ||
pull-request.en-us.md | ||
pull-request.zh-cn.md | ||
pull-request.zh-tw.md | ||
push.en-us.md | ||
push.zh-cn.md | ||
push.zh-tw.md | ||
repo-mirror.en-us.md | ||
repo-mirror.zh-cn.md | ||
secrets.en-us.md | ||
secrets.zh-cn.md | ||
template-repositories.en-us.md | ||
template-repositories.zh-cn.md | ||
webhooks.en-us.md | ||
webhooks.zh-cn.md | ||
webhooks.zh-tw.md |