Skip to content

Commit

Permalink
Fix NZB association for Windows.
Browse files Browse the repository at this point in the history
Make sure that the second SABnzbd instance sends an UTF-8 encoded URL to the first instance.
Otherwise CherryPy will reject the API call.
  • Loading branch information
shypike committed Jun 3, 2016
1 parent d82e69e commit 29e45da
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sabnzbd/utils/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import urllib
import logging
import os
from sabnzbd.encoding import unicoder
import sabnzbd.cfg as cfg
from sabnzbd.misc import get_ext, get_filename
import sabnzbd.newsunpack
Expand All @@ -34,6 +35,7 @@
def upload_file(url, fp):
""" Function for uploading nzbs to a running sabnzbd instance """
try:
fp = unicoder(fp).encode('utf-8')
fp = urllib.quote_plus(fp)
url = '%s&mode=addlocalfile&name=%s' % (url, fp)
# Add local apikey if it wasn't already in the registered URL
Expand Down

2 comments on commit 29e45da

@thezoggy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed with cherrypy 6.x?

@shypike
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, CP expects UTF-8, which makes sense.

Please sign in to comment.