homebysix / recipe-robot

A kick ass tool for creating AutoPkg recipes.
Apache License 2.0
300 stars 28 forks source link

Sparkle URL - division by zero ?? #136

Closed nilsbyte closed 5 years ago

nilsbyte commented 5 years ago

Whats happening here?

Processing https://api.skyfonts.com/api/SkyFontsAppCast?osid=3 ...
Input path looks like a download URL.
    Download URL is: https://api.skyfonts.com/api/SkyFontsAppCast?osid=3
Downloading file for further inspection...
[ERROR] Recipe Robot exploded with unexpected error: integer division or modulo by zero
Traceback (most recent call last):
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe-robot", line 95, in main
    process_input_path(facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 131, in process_input_path
    facts = inspect_func(input_path, args, facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 979, in inspect_download_url
    if (file_size_dl / block_sz) % (file_size / block_sz / 10) == 0:
ZeroDivisionError: integer division or modulo by zero

[ERROR] 

latest version of Recipe Robot on macOS 10.12.6

opus-nbonenberger commented 5 years ago

This also occurs on 10.14. with Recipe Robot 1.1.1 @homebysix can you check that?

homebysix commented 5 years ago

@nilsbyte @opus-nbo - I wasn't able to reproduce the "ZeroDivisionError" but I did find that Recipe Robot was treating your SkyFonts URL as a download URL instead of as a Sparkle feed. I've made a change in 8dfbaa6 that should fix that. Could you try again now from the latest master branch?

opus-nbonenberger commented 5 years ago

Thanks! I can try with another release if you do one. Can you test it with the URL above?

Lotusshaney commented 5 years ago

I can confirm this fixes the problem with SkyFonts, Thanks. as a note it will download the installer, but that is monotype fault as that is what the app itself gets

opus-nbonenberger commented 5 years ago

I don't know but now i have the same error with another URL:

Processing https://www.3ds.com/?eID=3ds_brand_download&uid=21&pidDown=13426&L=4 ...
Input path looks like a download URL.
    Download URL is: https://www.3ds.com/?eID=3ds_brand_download&uid=21&pidDown=13426&L=4
Downloading file for further inspection...
[ERROR] Recipe Robot exploded with unexpected error: integer division or modulo by zero
Traceback (most recent call last):
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe-robot", line 65, in main
    process_input_path(facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 147, in process_input_path
    facts = inspect_func(input_path, args, facts)
  File "/Applications/Recipe Robot.app/Contents/Resources/scripts/recipe_robot_lib/inspect.py", line 1035, in inspect_download_url
    if (file_size_dl / block_sz) % (file_size / block_sz / 10) == 0:
ZeroDivisionError: integer division or modulo by zero
homebysix commented 5 years ago

Good catch, thanks! Looks like the zero content-length might be an issue:

$ curl -IL "https://www.3ds.com/?eID=3ds_brand_download&uid=21&pidDown=13426&L=4"
HTTP/2 200 
cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
content-type: text/html; charset=utf-8
date: Fri, 01 Mar 2019 04:29:40 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
pragma: no-cache
server: nginx
set-cookie: PHPSESSID=server1~g3sgglgk39fijmnir0cuo9js11; path=/
set-cookie: fe_typo_user=fa434671553e42f0ff2077ccdf10a3a9; path=/; secure; httponly
set-cookie: visid_incap_1347125=2mJLoBwsR5KVcKpQHSupHTO1eFwAAAAAQUIPAAAAAABGATR2Ri6ohEoihFJTnPMU; expires=Fri, 28 Feb 2020 13:01:06 GMT; path=/; Domain=.3ds.com
set-cookie: incap_ses_867_1347125=2uY8ccUmQX7E+JAGkjQIDDO1eFwAAAAAEq61dbMDPSSL1/osa7YiAA==; path=/; Domain=.3ds.com
strict-transport-security: max-age=63072000; 
x-cdn: Incapsula
x-cdn-forward: edgecast
x-cdn-forward: edgecast
x-iinfo: 4-35111281-35111282 SNNN RT(1551414574368 4558) q(0 0 0 -1) r(6 6) U5
content-length: 0

I'm not sure how it gets all the way to that line, though because there's if file_size > 0: a few lines up.

What version of macOS are you running @opus-nbo ?

opus-nbonenberger commented 5 years ago

I am running 10.14.3, @homebysix