Skip to content

Commit

Permalink
fix parenthesis in filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
mlankenau committed Sep 19, 2023
1 parent 3e74885 commit 719c743
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/ex_ftp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ defmodule ExFtp do
end

def parse_ls_line(line) do
#IO.puts "parsing line: #{line}"
{:ok, map} = ExFtp.ParseLine.parse(line)
map
end
Expand Down
2 changes: 1 addition & 1 deletion lib/parse_line.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule ExFtp.ParseLine do

terminal :permissions, chars: [?d, ?r, ?w, ?x, ?-], min: 10, max: 10, prio: 0
terminal :time, chars: [?0, ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?:], min: 5, max: 5, prio: 0
terminal :string, chars: [?a..?z, ?A..?Z, ?0..?9, ?., ?-, ?_], prio: 1
terminal :string, chars: [?a..?z, ?A..?Z, ?0..?9, ?., ?-, ?_, ?), ?(], prio: 1

lr skip_whitespaces: true do
# drwxr-xr-x 49 1000 ftpgroup 1666 Jan 11 10:02 TMBJJ9NE3E0068343
Expand Down
7 changes: 7 additions & 0 deletions test/parse_line_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@ defmodule ExFtp.ParseLineTest do
)
end

test "parenthesis in filename" do
assert {:ok, %{name: "066ZA0172101 (1).pdf", timestamp: ~U[2023-09-18 15:23:00Z], type: :file}} =
parse(
"-rw-rw-r-- 1 1004 1004 146101 Sep 18 15:23 066ZA0172101 (1).pdf"
)
end

end

0 comments on commit 719c743

Please sign in to comment.