diff options
author | Christian Clason <c.clason@uni-graz.at> | 2024-07-30 19:18:41 +0200 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-07-31 00:18:43 +0200 |
commit | 34fa34e72033d107d9b133273fbd60ec57a2202c (patch) | |
tree | fd3e96000fe5fcb549ed0ef6b11dd06061e5af91 | |
parent | 1dd2bf926d14297e979509dbb731825a32f649b9 (diff) | |
download | rneovim-34fa34e72033d107d9b133273fbd60ec57a2202c.tar.gz rneovim-34fa34e72033d107d9b133273fbd60ec57a2202c.tar.bz2 rneovim-34fa34e72033d107d9b133273fbd60ec57a2202c.zip |
vim-patch:c4be066: runtime(zip): Opening a remote zipfile don't work
Problem: Opening a zipfile from HTTP gives an empty buffer.
Solution: Ensure that the magic bytes check does not
skip protocol processing.
Also use readblob() and remove commented out lines.
closes: vim/vim#15396
https://github.com/vim/vim/commit/c4be066817d560c870f67f1593630cfb5b39dfc8
Co-authored-by: Damien <141588647+xrandomname@users.noreply.github.com>
-rw-r--r-- | runtime/autoload/zip.vim | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index 79f707fbd8..f77d729f03 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -1,6 +1,6 @@ " zip.vim: Handles browsing zipfiles " AUTOLOAD PORTION -" Date: Jul 24, 2024 +" Date: Jul 30, 2024 " Version: 33 " Maintainer: This runtime file is looking for a new maintainer. " Former Maintainer: Charles E Campbell @@ -8,6 +8,7 @@ " 2024 Jun 16 by Vim Project: handle whitespace on Windows properly (#14998) " 2024 Jul 23 by Vim Project: fix 'x' command " 2024 Jul 24 by Vim Project: use delete() function +" 2024 Jul 20 by Vim Project: fix opening remote zipfile " License: Vim License (see vim's :help license) " Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, @@ -73,15 +74,11 @@ endif " --------------------------------------------------------------------- " zip#Browse: {{{2 fun! zip#Browse(zipfile) -" call Dfunc("zip#Browse(zipfile<".a:zipfile.">)") - " sanity check: insure that the zipfile has "PK" as its first two letters - " (zipped files have a leading PK as a "magic cookie") - if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK' - exe "noswapfile noautocmd noswapfile e ".fnameescape(a:zipfile) -" call Dret("zip#Browse : not a zipfile<".a:zipfile.">") + " sanity check: ensure that the zipfile has "PK" as its first two letters + " (zip files have a leading PK as a "magic cookie") + if filereadable(a:zipfile) && readblob(a:zipfile, 0, 2) != 0z50.4B + exe "noswapfile noautocmd e " .. fnameescape(a:zipfile) return -" else " Decho -" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - it's a zip file") endif let repkeep= &report @@ -97,9 +94,7 @@ fun! zip#Browse(zipfile) if !executable(g:zip_unzipcmd) redraw! echohl Error | echo "***error*** (zip#Browse) unzip not available on your system" -" call inputsave()|call input("Press <cr> to continue")|call inputrestore() let &report= repkeep -" call Dret("zip#Browse") return endif if !filereadable(a:zipfile) @@ -107,13 +102,10 @@ fun! zip#Browse(zipfile) " if it's an url, don't complain, let url-handlers such as vim do its thing redraw! echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None -" call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif let &report= repkeep -" call Dret("zip#Browse : file<".a:zipfile."> not readable") return endif -" call Decho("passed sanity checks") if &ma != 1 set ma endif |