commit 2bb0767cebfe29b45856a8dbbae9dfccfc01577d
parent 5be0afd2b1b614f9f8329182a1fe28e1d68d2e14
Author: René Wagner <rwa@clttr.info>
Date: Wed, 22 May 2024 21:15:57 +0200
fix handling of host-only URIs without trailing slash
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/autoload/gemivim.vim b/autoload/gemivim.vim
@@ -21,8 +21,12 @@ function! s:info_msg(msg)
endfunction
function! s:tmp_file_name(url, mime_type)
- let l:file = g:tmp_prefix . substitute(a:url, 'gemini://', '', 'g')
- if a:mime_type ==# 'text/gemini' && a:url =~# '/$'
+ let l:file = substitute(a:url, 'gemini://', '', 'g')
+ if match(l:file, '/') == -1
+ let l:file = l:file . '/'
+ endif
+ let l:file = g:tmp_prefix . l:file
+ if a:mime_type ==# 'text/gemini' && l:file =~# '/$'
return l:file . 'index.gmi'
else
return l:file
@@ -130,7 +134,7 @@ function! s:base_url(url)
endfunction
function! s:base_path(url)
- return substitute(a:url, '[^/]*$', '', '')
+ return substitute(a:url, '[^/]*$', '', '')
endfunction
function! s:relative_url(from, relative)