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

Issue1343 system_open_link E371 command not found Windows PowerShell and cmd #1396

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions autoload/vimwiki/base.vim
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function! vimwiki#base#system_open_link(url) abort
else
let url = shellescape(a:url, 1)
endif
execute 'silent ! start "Title" /B ' . url
execute 'silent !start ' .. url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the .. operator is synonym of the .
It would be nice to keep the same style for all Vimwiki code hence using the single dot ..

Please replace .. by .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:h expr5

For String concatenation ".." is preferred, since "." is ambiguous, it is also
used for |Dict| member access and floating point numbers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite Vim recommendation, I prefer keeping same style. At some point in the future, we may replace all . by ..


else

Expand All @@ -325,7 +325,7 @@ function! vimwiki#base#system_open_link(url) abort
else
let url = shellescape(a:url, 1)
endif
execute 'silent ! start ' . url
execute 'silent !start ' .. eval(url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the use of eval here is a bug. why to you evaluate a string like "http://www.example.com" ?
Plus it makes Vimwiki vulnerable to Remote Code Execution.

Please remote it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellescape(a:url, 1) always outputs a single quote string, which powershell and pwsh reject. To remove eval(), I replaced shellescape with escape(a:url, '%|*#').


endif
endfunction
Expand Down
7 changes: 7 additions & 0 deletions doc/vimwiki.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4019,6 +4019,7 @@ Contributors and their Github usernames in roughly chronological order:
- @jiamingc
- Alex Claman (@claman)
- @qadzek
- John D. Fisher (@jfishe)


==============================================================================
Expand All @@ -4038,6 +4039,12 @@ master is retained as a legacy mirror of the dev branch.
This is somewhat experimental, and will probably be refined over time.


2024.03.08~

Fixed:~
* Issue #1343: Fix/Improvement: Following HTML link on Windows PowerShell
or cmd.exe was broken by change to |:!start| behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job for adding the release note.

2024.01.24~

New:~
Expand Down
2 changes: 1 addition & 1 deletion plugin/vimwiki.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif
let g:loaded_vimwiki = 1

" Set to version number for release:
let g:vimwiki_version = '2024.01.24'
let g:vimwiki_version = '2024.03.08'

" Get the directory the script is installed in
let s:plugin_dir = expand('<sfile>:p:h:h')
Expand Down
2 changes: 1 addition & 1 deletion test/tag.vader
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Expect (Correctly formatted tags file):
!_TAG_PROGRAM_AUTHOR Vimwiki
!_TAG_PROGRAM_NAME Vimwiki Tags
!_TAG_PROGRAM_URL https://github.com/vimwiki/vimwiki
!_TAG_PROGRAM_VERSION 2023.05.12
!_TAG_PROGRAM_VERSION 2024.03.08
second-tag Test-Tag.md 13;" vimwiki:Test-Tag\tTest-Tag#second-tag\tTest-Tag#second-tag
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header\tA header
top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag\tTest-Tag
Expand Down