diff --git a/python/dnfdaemon/server/__init__.py b/python/dnfdaemon/server/__init__.py
index 06205461a0a9d25f6d995233a18b28e14f5281d1..38611c1a864e63649a0313c10c501c0c749aa3b2 100644
--- a/python/dnfdaemon/server/__init__.py
+++ b/python/dnfdaemon/server/__init__.py
@@ -485,7 +485,12 @@ class DnfDaemonBase(dbus.service.Object, DownloadCallback):
         """Install packages from pkg-specs."""
         value = 0
         local_rpms = []
+        # cmds can contain paths with escaped spaces
+        if '\\ ' in cmds:
+            cmds = cmds.replace('\\ ', '#')  # replace escaped spaces
         for cmd in cmds.split(' '):
+            if "#" in cmd:
+                cmd = cmd.replace('#', ' ')  # insert spaces again without '\\'
             if cmd.endswith('.rpm'):  # install local .rpm
                 local_rpms.append(cmd)
             else: