zdharma-continuum / zinit-annex-readurl

Other
5 stars 7 forks source link

[bug]: Parse error #11

Closed uberkael closed 2 years ago

uberkael commented 2 years ago

Describe the bug

I'm getting this error:

za-readurl-preinit-handler:179: parse error near elif

I guess there are some problems with parents here:

if [[ $selected = /* ]] {
  local domain protocol
  if [[ $dlpage = (#b)(#i)((http(s|)|ftp(s|)|ssh|scp)://|)([^/]##)(*) ]] {
    protocol=$match[1] domain=$match[5]
  }
  if [[ -z $domain ]] {
    +zinit-message "{pre}readurl annex: {ehi}ERROR:{error} couldn't establish the domain name (unsupported" \
      "protocol? supported are: {data}http(s){error},{data}ftp(s){error},{data}ssh{error},{data}scp{error}).{rst}"
    return 9
  }
  local new_url=${protocol:-http://}$domain$selected
elif [[ $selected = (#i)(http(s|)|ftp(s|)|ssh|scp)://* ]]; then
  local new_url=$selected
else
  local -a exts
  exts=(
    asp  aspx  cfm   cgi   ece htm
    html htmls jhtml js    jsp jspx
    php  php3  php4  phtml pl  py
    rb   rhtml shtml xhtml
  )
  if [[ $dlpage = *.(${(~j:|:)exts}) ]]; then
    local new_url=${dlpage:h}/$selected
  else
    local new_url=$dlpage/$selected
  fi
fi
# Assign in case a dlink0 given (i.e.: that this URL was the dlink0 URL)
dlpage=$new_url

fi

Steps to reproduce

zinit light zdharma-continuum/zinit-annex-readurl

Expected behavior

Not crashing.

Screenshots and recordings

image

Operating System & Version

Manjaro 21.3.2 linux-gnu | pc | x86_64 | x86_64 | x86_64 unknown

Zsh version

zsh 5.9 (x86_64-pc-linux-gnu)

Terminal emulator

xterm-256color

If using WSL on Windows, which version of WSL

No response

Additional context

No response

dhasial commented 2 years ago

Exact same error here after updating zinit a few minutes ago. I would expect it to be related to one of the more recent commits.

reverting to update-name branch/commit fixes it

vladdoster commented 2 years ago

@dhasial, @uberkael -- Sorry about that! Fixed!

vladdoster commented 2 years ago

If you're curious, this was the issue

https://github.com/zdharma-continuum/zinit-annex-readurl/commit/65cc56ed0cca860ed6286ce41ed6c3d5ef0edaa2#diff-331f68ff6ba7efd25e9e1dbabdcf36e328b70b65c4213a7f37f260298c5b286eR167

uberkael commented 2 years ago

This solved the problem. Thanks!