From b92e75b7e711161467ca4805260b787e652358bf Mon Sep 17 00:00:00 2001 From: JINNOUCHI Yasushi Date: Thu, 1 Aug 2024 04:41:43 +0900 Subject: [PATCH] fix: deal with lack of opts.attachment (#674) * fix: deal with lack of opts.attachment * docs: add note for this change --- CHANGELOG.md | 1 + lua/obsidian/config.lua | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81bd7d6c7..b585ed0e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed an edge case with collecting backlinks. - Fixed typo in `ObsidianPasteImg`'s command description +- Fixed the case when `opts.attachments` is `nil`. ## [v3.9.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v3.9.0) - 2024-07-11 diff --git a/lua/obsidian/config.lua b/lua/obsidian/config.lua index 63ccfa67d..4f3ae84de 100644 --- a/lua/obsidian/config.lua +++ b/lua/obsidian/config.lua @@ -208,6 +208,9 @@ config.ClientOpts.normalize = function(opts, defaults) end if opts.image_name_func then + if opts.attachments == nil then + opts.attachments = {} + end opts.attachments.img_name_func = opts.image_name_func opts.image_name_func = nil end