Sending nzb through api using api addurl results in bad nzbname

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

SABnzbd version: 3.1.1
Running on windows 10.'

I'm using Medusa in combination with Prowlarr.
Prowlarr functions as a newznab indexer. Medusa is getting an url back from prowlarr that downloads the nzb. Medusa sends the url using the Sabnzbd api "addurl" command.

Medusa has been doing this for many years. But only recently when we've added prowlarr support we've started noticing this issue.
The problem here is that the url returned by prowlarr is a valid url. When pasting it in the browser it will download the nzb for you.

This is the request that's being send to sab:

The nzb name is parsed as: `Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb; filename@=UTF-8''Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb`
Also the download is created with this name.

Let me know if you need more info.
The issue has been reported by a few Medusa users now. And it can be reproduced when using Medua + prowlarr + sabnzbd

Logs: https://gist.github.com/p0psicles/bd5d4 ... 1a88b92527
Last edited by p0psicles on August 22nd, 2021, 5:32 am, edited 1 time in total.
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Re: Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

I'd like to add some logs and the api request send to sab. But i'm a new user so I can't post links yet. I'll wait until I can update this post.
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Sending nzb through api using api addurl results in bad nzbname

Post by safihre »

I am not sure what is going on here, where it is adding this extra UTF-8 part.
Is this inside the headers or on the NZB file?
I'm not sure I want to setup the whole chain just to check if it's even SABnzbd's problem.. Is there any way I can test it somewhere?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Re: Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

safihre wrote: August 23rd, 2021, 2:57 am Is this inside the headers or on the NZB file?
Sorry I don't understand that question. Or maybe I do? When I upload the NZB manual to sab it's Working fine. So I guess the headers?

I could try run sab on my dev machine in vscode. And get some debugging going on. Then we could do something like a teamviewer. That way you can step through it with the entire chain set up?
User avatar
jcfp
Release Testers
Release Testers
Posts: 986
Joined: February 7th, 2008, 12:45 pm

Re: Sending nzb through api using api addurl results in bad nzbname

Post by jcfp »

For the info inside the nzb, simply open the file in a text editor and check the metadata (typically near the very top). For the headers, download the nzb from that localhost port 9696 url with some util or browser that displays the http headers, such as the developer console/tool of common browsers (firefox, chromium).
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Re: Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

I've tracked it down to the content-disposition header.
https://imgur.com/a/vQfMif1

value here is:

Code: Select all

attachment; filename=Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb; filename*=UTF-8''Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb
here:
https://github.com/sabnzbd/sabnzbd/blob ... er.py#L194
It will parse into:

Code: Select all

Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb; filename*=UTF-8''Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb
So now it's the discussion is prowlarr at fault, for returning that header. Or sabnzbd for parsing it this freely?

Personally I would use a regex for this. Something like:

Code: Select all

re.match(r'.*filename=([^=;]+)', value).group(1)
I can create a PR if you'd like?
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Sending nzb through api using api addurl results in bad nzbname

Post by safihre »

Thanks for debugging!
It seems Prowlarr is doing things according to the RFC standard, and SABnzbd is wrong:
https://datatracker.ietf.org/doc/html/r ... tion-3.2.2
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Re: Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

Is there something I can do?
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Sending nzb through api using api addurl results in bad nzbname

Post by safihre »

No, I need to fix it!
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Re: Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

I see your going to do a release. Any chance this could get included? I could do a pr today. If you don't have time your self. I would like to provide a solution to my users.

Ow wait you already tagged.
I can still do the pr.
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Sending nzb through api using api addurl results in bad nzbname

Post by safihre »

Sorry I forgot. Yes, can you indeed do a PR?
It should work for all these 3 cases:

Code: Select all

filename=Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb; filename*=UTF-8''Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb
filename=Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb;
filename*=UTF-8''Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Re: Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

done
p0psicles
Newbie
Newbie
Posts: 8
Joined: August 22nd, 2021, 5:05 am

Re: Sending nzb through api using api addurl results in bad nzbname

Post by p0psicles »

Done.
The regex I used should support those three formats. I tested it icw Medusa+prowlarr, and that works
Post Reply