Skip to content

Commit

Permalink
Handle the rare case when renamed string is ".."
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalexling committed Jun 9, 2020
1 parent 45cdfd5 commit e53641a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/rename.cr
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,19 @@ module Rename
end

def render(hash : VHash)
@ary.map do |e|
str = @ary.map do |e|
if e.is_a? String
e
else
e.render hash
end
end.join
.strip
.gsub("/", "_")
end.join.strip
post_process str
end

private def post_process(str)
return "_" if str == ".."
str.gsub "/", "_"
end
end
end

0 comments on commit e53641a

Please sign in to comment.