Advertisement
Guest User

aurget urlencode patch

a guest
Jun 19th, 2010
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.17 KB | None | 0 0
  1. 135a136,154
  2. > # url encode a string
  3. > url_encode() {
  4. >   [ $# -lt 1 ] && { return; }
  5. >
  6. >   encodedurl="$1";
  7. >
  8. >   # make sure hexdump exists, if not, just give back the url
  9. >   [ ! -x "/usr/bin/hexdump" ] && { return; }
  10. >
  11. >   encodedurl=`
  12. >     echo $encodedurl | hexdump -v -e '1/1 "%02x\t"' -e '1/1 "%_c\n"' |
  13. >     LANG=C awk '
  14. >       $1 == "20"                    { printf("%s",   "+"); next } # space becomes plus
  15. >       $1 ~  /0[adAD]/               {                      next } # strip newlines
  16. >       $2 ~  /^[a-zA-Z0-9.*()\/-]$/  { printf("%s",   $2);  next } # pass through what we can
  17. >                                     { printf("%%%s", $1)        } # take hex value of everything else
  18. >     '`
  19. > }
  20. >
  21. 585c604,605
  22. <     read -r Name Version URLPath < <(wget -q -O - "${aur_info}${name}" | grep -Fv -- "\"No result found\"" | sed -e 's/.*"Name":"\([^"]*\)".*"Version":"\([^"]*\)".*"URLPath":"\([^"]*\)".*/ \2 \3/g')
  23. ---
  24. >     url_encode "${name}"
  25. >     read -r Name Version URLPath < <(wget -q -O - "${aur_info}${encodedurl}" | grep -Fv -- "\"No result found\"" | sed -e 's/.*"Name":"\([^"]*\)".*"Version":"\([^"]*\)".*"URLPath":"\([^"]*\)".*/ \2 \3/g')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement