diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/rclone.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lua/rclone.lua b/lua/rclone.lua index 27809bf..308f06c 100644 --- a/lua/rclone.lua +++ b/lua/rclone.lua @@ -248,7 +248,14 @@ local function copyFile(options) -- build relative path to file for local and remote local Path = require('plenary.path') local local_file_path = Path:new(vim.fn.expand('%')):absolute() - local local_file_path_relative = local_file_path:gsub(local_path:gsub('([^%w])', '%%%1'), '') + local local_path_pattern = local_path:gsub('([^%w])', '%%%1') + + if local_file_path:find(local_path_pattern) == nil then + print('Local path not in file path') + return + end + + local local_file_path_relative = local_file_path:gsub(local_path_pattern, '') local local_file_path_relative_parent = Path:new(local_file_path_relative):parent().filename local cmd = |