Page 1 of 1

Filename truncated when source contains square bracket

Posted: August 5th, 2023, 11:56 pm
by guitarboy
Example filename: XXX.YYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost

Download succeeds but ends up in the path "C:\Downloads\complete\TV\XXX.YYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost\eztv.1.re"

Windows doesn't recognize it as an .MKV file and it is not moved into the "C:\Downloads\complete\TV\XXX YYY\Season 2" folder.

Is there a switch to prevent this from happening?

Re: Filename truncated when source contains square bracket

Posted: August 6th, 2023, 1:42 am
by sander
Can you see in sabnzbd.log why this is happening? Is it because of Series renaming / sorting / ... ?


And maybe ... Config -> Switched -> "make Windows compatible" helps?

EDIT:

I've create a test NZB with brackets for you: https://raw.githubusercontent.com/sande ... reMore.nzb
In SABnzbd, add it as URL, and download it. What is the resulting naming of the file ... ?

It works nicely (on my Ubuntu), and I expect too on your setup...

Re: Filename truncated when source contains square bracket

Posted: August 6th, 2023, 3:52 pm
by guitarboy
Can you see in sabnzbd.log why this is happening? Is it because of Series renaming / sorting / ... ?
The filename appears to be truncated in the Incomplete folder right after download completes. e.g.

Code: Select all

2023-08-06 13:07:25,291::DEBUG::[deobfuscate_filenames:112] Checking: <HASH><HASH>4e5392b1b7a77f
2023-08-06 13:07:25,291::DEBUG::[deobfuscate_filenames:124] Obfuscated: starting with 40+ lower case hex digits and/or dots
2023-08-06 13:07:25,292::DEBUG::[nzbstuff:1902] Saving attributes {'cat': 'tv', 'pp': 3, 'script': 'None', 'priority': 0, 'final_name': 'XXXX.YYYYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost', 'password': None, 'url': None} for XXXX.YYYYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost
2023-08-06 13:07:25,293::DEBUG::[assembler:79] Decoding part of \\?\C:\Downloads\incomplete\XXXX.YYYYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost\eztv.re
2023-08-06 13:07:25,293::DEBUG::[filesystem:1119] [sabnzbd\nzbstuff.py.save_to_disk] Saving data for SABnzbd_nzo_9v7es620 in \\?\C:\Downloads\incomplete\XXXX.YYYYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost\__ADMIN__
2023-08-06 13:07:25,344::INFO::[assembler:87] Decoding finished \\?\C:\Downloads\incomplete\XXXX.YYYYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost\eztv.re
2023-08-06 13:07:25,365::DEBUG::[nzbstuff:453] Removing article database for SABnzbd_nzf_v3_7rd1a
2023-08-06 13:07:25,365::DEBUG::[filesystem:913] [sabnzbd\nzbstuff.py.remove_admin] Deleting file \\?\C:\Downloads\incomplete\XXXX.YYYYY.S02E01.1080p.WEB.h264-EDITH[eztv.re].mkv-xpost\__ADMIN__\SABnzbd_nzf_v3_7rd1a
The log file is too long to embed here but I can send it to you.
And maybe ... Config -> Switched -> "make Windows compatible" helps?
I can't find this switch. I searched the Config page but it doesn't appear. Advanced Settings is checked.
In SABnzbd, add it as URL, and download it. What is the resulting naming of the file ... ?
C:\Downloads\complete\RefTestNZB_1234_Brackets[fake.re]MoreMore\MyRandomFile_100MB[fake.re]MoreMore.bin

That appears to be correct.

Using SABnzbd 4.0.3 [9fafe64]

Re: Filename truncated when source contains square bracket

Posted: August 6th, 2023, 4:01 pm
by sander
But do you have Sorting on? So: http://127.0.0.1:8080/sabnzbd/config/sorting/


Make Windows compatible is here:
http://127.0.0.1:8080/sabnzbd/config/sw ... itize_safe

Re: Filename truncated when source contains square bracket

Posted: August 6th, 2023, 5:03 pm
by guitarboy
But do you have Sorting on? So: http://127.0.0.1:8080/sabnzbd/config/sorting/
Yes, Series Sorting is enabled and set to: %sn/%sn - S%0sE%0e - %en.%ext
Make Windows compatible is here:
http://127.0.0.1:8080/sabnzbd/config/sw ... itize_safe
Not there! Here's a screenshot of that page: https://imgur.com/a/7zWsbBo

Re: Filename truncated when source contains square bracket

Posted: August 7th, 2023, 1:22 am
by sander
> Not there!

Ah. Maybe because you are on Windows that option is not there. And that feature is then on by default.

Anyway: I think we can safely say it's due to Sorting. And I know about nothing about that. Wild guesses for the cause: the brackets have a special meaning in regular expressions. And even .re has a meaning: it means ... regular expression.

Maybe someone else can help further.

Re: Filename truncated when source contains square bracket

Posted: August 7th, 2023, 1:33 am
by OneCD
sander wrote: August 7th, 2023, 1:22 am > Not there!

Ah. Maybe because you are on Windows that option is not there. And that feature is then on by default.
The 'Naming' section only appears on that page when you check the 'Advanced Settings' box at the top-right of the screen. ;)

Re: Filename truncated when source contains square bracket

Posted: August 7th, 2023, 10:01 am
by guitarboy
The 'Naming' section only appears on that page when you check the 'Advanced Settings' box at the top-right of the screen.
“Advanced Settings” is turned on. As @Sander says, the switch doesn’t appear to be available on Windows.

Re: Filename truncated when source contains square bracket

Posted: August 7th, 2023, 1:07 pm
by safihre
Indeed it's not shown on Windows.
But this sounds indeed like a bug, if you happen to have a Github account could you create an Issue on our Github?

Re: Filename truncated when source contains square bracket

Posted: August 7th, 2023, 2:35 pm
by guitarboy
But this sounds indeed like a bug
Which is the bug: the hidden Windows switch or the anomalous renaming?

I’m happy to report either or both.

Re: Filename truncated when source contains square bracket

Posted: August 7th, 2023, 2:59 pm
by sander
The renaming, with Sorting on. And you have the standard sorting, so that's good.

Re: Filename truncated when source contains square bracket

Posted: October 19th, 2023, 10:38 pm
by wadsworth
I believe I'm hitting this same issue for nzb file names containing square brackets, although it seems to occur regardless of whether sorting is enabed.
In my case the files are renamed to ".h264" instead of ".re" like the original poster.

Further details and log file here...
pastebin DOT com SLASH WKYRa7RU

My NZB search indexer shows the correct extensions on the files, such as:
* small file is the .nfo
* large file is the .mkv

Happy to provide further details or open a bug if needed, just let me know.

Re: Filename truncated when source contains square bracket

Posted: October 20th, 2023, 12:56 am
by sander
wadsworth wrote: October 19th, 2023, 10:38 pm I believe I'm hitting this same issue for nzb file names containing square brackets, although it seems to occur regardless of whether sorting is enabed.
In my case the files are renamed to ".h264" instead of ".re" like the original poster.

Further details and log file here...
pastebin DOT com SLASH WKYRa7RU

My NZB search indexer shows the correct extensions on the files, such as:
* small file is the .nfo
* large file is the .mkv

Happy to provide further details or open a bug if needed, just let me know.

If you look inside the .NZB itself, you see the subject (which should tellthe filename):

subject="[PRiVATE]-[WtFnZb]-[/Blbabla.2021.S02E04.1080p.WEB.h264-EDITH[eztv.re].mkv-WtF[nZb]/WtF[nZb].nfo]-[2/2] - &quot;&quot; yEnc 12 (1/1)"

So: a lot of []'s and even an embedded []. I had an (ugly?) workaround for that in SABnzbd, but AFAIK Safihre decided he did not want that in the SABnzbd code.

Furthermore, in SAB, "h264" is defined as a common extension, so SAB does not change the extesion to .mkv

Re: Filename truncated when source contains square bracket

Posted: October 20th, 2023, 1:18 pm
by wadsworth
Thanks for taking a look sander. I'll take check the subject and report back.