Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not be used in windows platrom. Can not access vault name #23

Open
Sologala opened this issue Oct 13, 2024 · 5 comments
Open

Can not be used in windows platrom. Can not access vault name #23

Sologala opened this issue Oct 13, 2024 · 5 comments

Comments

@Sologala
Copy link

E5108: Error executing lua: vim/_editor.lua:431: nvim_exec2()..BufEnter Autocommands for "*": Vim(append):Erro
r executing lua callback: ...idian-bridge.nvim/lua/obsidian-bridge/event_handlers.lua:12: attempt to index loc
al 'vault_name' (a nil value)
stack traceback:
        ...idian-bridge.nvim/lua/obsidian-bridge/event_handlers.lua:12: in function 'get_vault_name'
        ...idian-bridge.nvim/lua/obsidian-bridge/event_handlers.lua:31: in function 'get_active_buffer_obsidia
n_markdown_filename'
        ...idian-bridge.nvim/lua/obsidian-bridge/event_handlers.lua:44: in function <...idian-bridge.nvim/lua/
obsidian-bridge/event_handlers.lua:39>
        [C]: in function 'nvim_exec2'
        vim/_editor.lua:431: in function 'cmd'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:200: in function 'switch_buf_if_last_buf'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:220: in function 'close'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:239: in function 'close_this_tab_only'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:252: in function 'close'
        ...y/nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua:418: in function 'fn'
        ...Local/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/api.lua:210: in function 'edit'
        ...Local/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/api.lua:222: in function <...Local/nvim-data/lazy/
nvim-tree.lua/lua/nvim-tree/api.lua:216>
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua:431: in function 'cmd'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:200: in function 'switch_buf_if_last_buf'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:220: in function 'close'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:239: in function 'close_this_tab_only'
        ...ocal/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:252: in function 'close'
        ...y/nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua:418: in function 'fn'
        ...Local/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/api.lua:210: in function 'edit'
        ...Local/nvim-data/lazy/nvim-tree.lua/lua/nvim-tree/api.lua:222: in function <...Local/nvim-data/lazy/
nvim-tree.lua/lua/nvim-tree/api.lua:216>
@Sologala
Copy link
Author

Seems like the funciton named get_vault_name cannot parse vault name correctlly.
I modify it to get vault name with vim.fs api.

 local function get_vault_name(path)
 	local current_path = vim.fn.expand(path)
-	while current_path ~= "/" do
-		local obsidian_folder = current_path .. "/.obsidian"
-		if vim.fn.isdirectory(obsidian_folder) == 1 then
-			local vault_name = obsidian_folder:match("/([^/]+)/%.obsidian$")
-			return vault_name:gsub("([^%w])", "%%%1")
-		end
-		current_path = vim.fn.fnamemodify(current_path, ":h")
-	end
+    while current_path ~= "/" do
+        local obsidian_folder = current_path .. "\\.obsidian"
+        if vim.fn.isdirectory(obsidian_folder) == 1 then
+            local vault_name = vim.fn.fnamemodify(current_path, ":t")
+            print("obsidian_folder is " .. obsidian_folder)
+            print("vault_name is " .. vault_name)
+            return vault_name:gsub("([^%w])", "%%%1")
+        end
+        current_path = vim.fn.fnamemodify(current_path, ":h")
+    end
 	return false

@Sologala
Copy link
Author

But I got this error as follows,

post https://localhost:27124/open/TODO.md - curl error exit_code=60 stderr={ "curl: (60) schannel: SEC_E_UNTRUSTED_ROOT (0x80090325) - ֤<ca><e9>t<ca><c7><d3>ɲ<bb><ca><dc><d0><c5><c8>İ䷢<bb><fa><b9><b9><b0>䷢<b5>ġ<a3>", "More details here: https://curl.se/docs/sslcerts.html", "", "curl failed to verify the legitimacy of the server and therefore could not", "establish a secure connection to it. To learn more about this situation and", "how to fix it, please visit the webpage mentioned above." }  

Do you Guys know how to tackle it ?

@ficcdaf
Copy link
Contributor

ficcdaf commented Nov 18, 2024

But I got this error as follows,

post https://localhost:27124/open/TODO.md - curl error exit_code=60 stderr={ "curl: (60) schannel: SEC_E_UNTRUSTED_ROOT (0x80090325) - ֤<ca><e9>t<ca><c7><d3>ɲ<bb><ca><dc><d0><c5><c8>İ䷢<bb><fa><b9><b9><b0>䷢<b5>ġ<a3>", "More details here: https://curl.se/docs/sslcerts.html", "", "curl failed to verify the legitimacy of the server and therefore could not", "establish a secure connection to it. To learn more about this situation and", "how to fix it, please visit the webpage mentioned above." }  

Do you Guys know how to tackle it ?

This seems like an SSL cert error. Try enabling the HTTP server in the Local REST Api Obsidian plugin. If that does not work either, I suspect your vault name has some unusual characters in it.

@RobberFox
Copy link

RobberFox commented Dec 13, 2024

But I got this error as follows,

post https://localhost:27124/open/TODO.md - curl error exit_code=60 stderr={ "curl: (60) schannel: SEC_E_UNTRUSTED_ROOT (0x80090325) - ֤<ca><e9>t<ca><c7><d3>ɲ<bb><ca><dc><d0><c5><c8>İ䷢<bb><fa><b9><b9><b0>䷢<b5>ġ<a3>", "More details here: https://curl.se/docs/sslcerts.html", "", "curl failed to verify the legitimacy of the server and therefore could not", "establish a secure connection to it. To learn more about this situation and", "how to fix it, please visit the webpage mentioned above." }  

Do you Guys know how to tackle it ?

For some reason on I get this error on my PC but don't on my laptop, even though it's both Linux Debian and the same nvim config. So on my PC I have to use HTTP instead of HTTPS

@ficcdaf
Copy link
Contributor

ficcdaf commented Dec 13, 2024

@RobberFox could you try using the cert_path configuration options and let me know if that works? Also, note that by default localhost will not work with the certificate provided by the REST plugin, you need to use 127.0.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants