From 2e9eed31990558ccf89be70046eb621a880dd0b5 Mon Sep 17 00:00:00 2001
From: Rodrigo Nonose <rodrigo.nonose89@gmail.com>
Date: Wed, 9 May 2018 00:35:23 -0300
Subject: [PATCH] Limit split parts to allow equal characters in path (#49)

---
 lib/file_system/backends/fs_mac.ex | 2 +-
 test/backends/fs_mac_test.exs      | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/file_system/backends/fs_mac.ex b/lib/file_system/backends/fs_mac.ex
index 6e53d23..267c010 100644
--- a/lib/file_system/backends/fs_mac.ex
+++ b/lib/file_system/backends/fs_mac.ex
@@ -170,7 +170,7 @@ defmodule FileSystem.Backends.FSMac do
   end
 
   def parse_line(line) do
-    [_, _, events, path] = line |> to_string |> String.split(["\t", "="])
+    [_, _, events, path] = line |> to_string |> String.split(["\t", "="], parts: 4)
     {path, events |> String.split(~w|[ , ]|, trim: true) |> Enum.map(&String.to_existing_atom/1)}
   end
 
diff --git a/test/backends/fs_mac_test.exs b/test/backends/fs_mac_test.exs
index 38edb4a..67a504a 100644
--- a/test/backends/fs_mac_test.exs
+++ b/test/backends/fs_mac_test.exs
@@ -32,5 +32,10 @@ defmodule FileSystem.Backends.FSMacTest do
       assert {"/one two/file", [:inodemetamod, :modified]} ==
         parse_line('37425557\t0x00011400=[inodemetamod,modified]\t/one two/file')
     end
+
+    test "equal character in file" do
+      assert {"/one two/file=2", [:inodemetamod, :modified]} ==
+        parse_line('37425557\t0x00011400=[inodemetamod,modified]\t/one two/file=2')
+    end
   end
 end
-- 
GitLab