Skip to content

Commit 0e4cf21

Browse files
committed
feedback: update docs, support ..folder
1 parent 70a41a3 commit 0e4cf21

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

docs/user/reference/cli/azldev_component_render.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/app/azldev/cmds/component/render.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,8 @@ func resolveAndValidateOutputDir(env *azldev.Env, options *RenderOptions) error
879879
// cleanupStaleRenders to delete unrelated directories.
880880
func validateOutputDir(outputDir string) error {
881881
cleaned := filepath.Clean(outputDir)
882-
if cleaned == "." || cleaned == string(filepath.Separator) || strings.HasPrefix(cleaned, "..") {
882+
if cleaned == "." || cleaned == string(filepath.Separator) ||
883+
cleaned == ".." || strings.HasPrefix(cleaned, ".."+string(filepath.Separator)) {
883884
return fmt.Errorf(
884885
"output directory %#q is unsafe; use a dedicated subdirectory (e.g., ./SPECS/)", outputDir)
885886
}

internal/app/azldev/cmds/component/render_internal_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ func TestValidateOutputDir(t *testing.T) {
153153
}{
154154
{"SPECS", false},
155155
{"rendered/output", false},
156+
{"..foo", false},
157+
{"./../foo/../", true},
156158
{".", true},
157159
{"/", true},
158160
{"./", true},

0 commit comments

Comments
 (0)