0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-13 16:29:10 +01:00
gitea/modules/repository
Kyle D 8220e50b56
Substitute variables in path names of template repos too (#25294)
### 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](https://github.com/go-gitea/gitea/assets/12700993/621feb09-0ef3-460e-afa8-da74cd84fa4e)
2023-06-20 21:14:47 +00:00
..
collaborator_test.go
collaborator.go
commits_test.go
commits.go
create_test.go
create.go Remove stars when repo goes private (#19904) 2023-06-05 13:25:43 +00:00
delete.go
env.go
fork.go
generate_test.go Substitute variables in path names of template repos too (#25294) 2023-06-20 21:14:47 +00:00
generate.go Substitute variables in path names of template repos too (#25294) 2023-06-20 21:14:47 +00:00
hooks.go
init_test.go
init.go
license_test.go
license.go
main_test.go
push.go Use the type RefName for all the needed places and fix pull mirror sync bugs (#24634) 2023-05-26 01:04:48 +00:00
repo.go Use git command instead of the ini package to remove the origin remote (#25066) 2023-06-05 18:05:31 +08:00
temp.go