Skip to content
This repository was archived by the owner on Mar 23, 2025. It is now read-only.

Commit e53641a

Browse files
committed
Handle the rare case when renamed string is ".."
1 parent 45cdfd5 commit e53641a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/rename.cr

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,19 @@ module Rename
129129
end
130130

131131
def render(hash : VHash)
132-
@ary.map do |e|
132+
str = @ary.map do |e|
133133
if e.is_a? String
134134
e
135135
else
136136
e.render hash
137137
end
138-
end.join
139-
.strip
140-
.gsub("/", "_")
138+
end.join.strip
139+
post_process str
140+
end
141+
142+
private def post_process(str)
143+
return "_" if str == ".."
144+
str.gsub "/", "_"
141145
end
142146
end
143147
end

0 commit comments

Comments
 (0)