diff --git a/plugins/convertPathData.js b/plugins/convertPathData.js
index d5386369b..c100dd263 100644
--- a/plugins/convertPathData.js
+++ b/plugins/convertPathData.js
@@ -828,15 +828,12 @@ function filters(
item.command = command;
item.args = data;
-
- prev = item;
} else {
// z resets coordinates
relSubpoint[0] = pathBase[0];
relSubpoint[1] = pathBase[1];
// @ts-ignore
if (prev.command === 'Z' || prev.command === 'z') return false;
- prev = item;
}
if (
(command === 'Z' || command === 'z') &&
@@ -849,6 +846,7 @@ function filters(
)
return false;
+ prev = item;
return true;
});
diff --git a/test/plugins/convertPathData.29.svg b/test/plugins/convertPathData.29.svg
new file mode 100644
index 000000000..bed381366
--- /dev/null
+++ b/test/plugins/convertPathData.29.svg
@@ -0,0 +1,15 @@
+Should merge M and m, even when Z command is used between.
+
+===
+
+
+
+@@@
+
+
\ No newline at end of file