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

Division by Zero When Aria2 Cannot Calculate Content Length #169

Open
solonovamax opened this issue Dec 15, 2024 · 0 comments · May be fixed by #170
Open

Division by Zero When Aria2 Cannot Calculate Content Length #169

solonovamax opened this issue Dec 15, 2024 · 0 comments · May be fixed by #170

Comments

@solonovamax
Copy link

solonovamax commented Dec 15, 2024

Describe the bug
There is a division by zero which occurs when aria2 cannot fetch the content length (eg. no Content-Length header)

To Reproduce
Steps to reproduce the behavior:

  1. Download a file from a url with no Content-Length header
  2. Navigate to "Active Downloads"
  3. Observe a 500 server error in the console

Expected behavior
No error occurs

Desktop (please complete the following information):

  • OS: Arch Linux 6.12.3-zen1-1-zen x86_64
  • Browser Firefox Developer Edition
  • Version 134.0b7

Log Message

{
  "reqId": "Ghd94bYhnIJnZ22rgf4h",
  "level": 3,
  "time": "2024-12-15T02:29:25-05:00",
  "remoteAddr": "163.123.169.197",
  "user": "solonovamax",
  "app": "index",
  "method": "POST",
  "url": "/index.phpwnloader/status/active",
  "message": "Division by zero in file '/var/www/nextcloud/apps/ncdownloader/lib/Controller/Aria2Controller.php' line 210",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:134.0) Gecko/20100101 Firefox/134.0",
  "version": "29.0.10.1",
  "exception": {
    "Exception": "Exception",
    "Message": "Division by zero in file '/var/www/nextcloud/apps/ncdownloader/lib/Controller/Aria2Controller.php' line 210",
    "Code": 0,
    "Trace": [
      { "file": "/var/www/nextcloud/lib/private/AppFramework/App.php", "line": 184, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" },
      { "file": "/var/www/nextcloud/lib/private/Route/Router.php", "line": 331, "function": "main", "class": "OC\\AppFramework\\App", "type": "::" },
      { "file": "/var/www/nextcloud/lib/base.php", "line": 1060, "function": "match", "class": "OC\\Route\\Router", "type": "->" },
      { "file": "/var/www/nextcloud/index.php", "line": 49, "function": "handleRequest","class": "OC", "type": "::" }
    ],
    "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 170,
    "Previous": {
      "Exception": "DivisionByZeroError",
      "Message": "Division by zero",
      "Code": 0,
      "Trace": [
        { "file": "/var/www/nextcloud/apps/ncdownloader/lib/Controller/Aria2Controller.php", "line": 161, "function": "transformResp", "class": "OCA\\NCDownloader\\Controller\\Aria2Controller", "type": "->" },
        { "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php", "line": 232, "function":"getStatus", "class": "OCA\\NCDownloader\\Controller\\Aria2Controller", "type": "->" },
        { "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php", "line": 138, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" },
        { "file": "/var/www/nextcloud/lib/private/AppFramework/App.php", "line": 184, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" },
        { "file": "/var/www/nextcloud/lib/private/Route/Router.php", "line": 331, "function": "main", "class": "OC\\AppFramework\\App", "type": "::" },
        { "file": "/var/www/nextcloud/lib/base.php", "line": 1060, "function": "match", "class": "OC\\Route\\Router", "type": "->" },
        { "file": "/var/www/nextcloud/index.php", "line": 49, "function": "handleRequest", "class": "OC", "type": "::" },
      ],
      "File": "/var/www/nextcloud/apps/ncdownloader/lib/Controller/Aria2Controller.php",
      "Line": 210
    },
    "message": "Division by zero in file '/var/www/nextcloud/apps/ncdownloader/lib/Controller/Aria2Controller.php' line 210",
    "exception": [],
    "CustomMessage": "Division by zero in file '/var/www/nextcloud/apps/ncdownloader/lib/Controller/Aria2Controller.php' line 210"
  },
  "id": "675e889ac913f"
}
@solonovamax solonovamax linked a pull request Dec 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant