OS of the actual folder location. (Stripping illegal chars)

Want something added? Ask for it here.
Post Reply
phoenixxl
Newbie
Newbie
Posts: 11
Joined: March 29th, 2012, 6:33 am

OS of the actual folder location. (Stripping illegal chars)

Post by phoenixxl »

This hovers somewhere between a bug and a missing feature I suppose , so for form's sake I'll mention it here.

As sabnzbd+ works now , the feature that strips illegal characters and replaces them by allowed ones polls the OS sab is installed on to determine which characters to replace.

This gives an issue with linux systems who use cifs to map network shares on windows machines and vice versa. Folders cannot be created.

To fix this , I would say a per-folder option to turn on stripping , and with it the method to be used would seem the most versatile solution to this.
The ugliest implementation , add a textbox , if empty do nothing , else strip depending on what's in it.. ['\/<>?*|"','++{}!@#`'] or ['/','+']

This doesn't seem to be trivial either , since , from what I see from the source stripping would have to be done on a different level than now.

I do not want/expect any yes/no answer. I am mentioning this here when the next version gets started on this can be kept in mind by the people doing so.

Regards.

edit:
Another quick fix needing only a flag would be to always replace everything that could create issues with any OS... mac , linux , pc .. / and \ etc ...
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: OS of the actual folder location. (Stripping illegal cha

Post by shypike »

This is a problem that cannot be solved.
When SABnzbd renames files, the first thing the par2 program will do is try to rename them
to their original names. Which will subsequently fail.
phoenixxl
Newbie
Newbie
Posts: 11
Joined: March 29th, 2012, 6:33 am

Re: OS of the actual folder location. (Stripping illegal cha

Post by phoenixxl »

Stripping illegal characters of folders is already being done..

This is what I'm talking about:

In misc.py :

Code: Select all

################################################################################
# sanitize_filename                                                            #
################################################################################
if sabnzbd.WIN32:
    # the colon should be here too, but we'll handle that separately
    CH_ILLEGAL = r'\/<>?*|"'
    CH_LEGAL   = r'++{}!@#`'
else:
    CH_ILLEGAL = r'/'
    CH_LEGAL   = r'+'
It is being done already . The problem is sab assumes all paths on linux point to linux filesystems , and all paths on windows point to windows filesystems.
When sab creates a directory on a network share to a windows machine from a linux one , the directory cannot be created.
shypike wrote: the par2 program will do is try to rename them
I am not talking about renaming files before processing. I am talking about fixing a system already in place to allow output to network shares of a different OS.
Mikasa
Newbie
Newbie
Posts: 1
Joined: June 20th, 2013, 11:35 pm

Re: OS of the actual folder location. (Stripping illegal cha

Post by Mikasa »

Kun you not delete the if-else , then it will always strip like windows.
You can then forking in git then kloon.

################################################################################
# sanitize_filename #
################################################################################
# the colon should be here too, but we'll handle that separately
CH_ILLEGAL = r'\/<>?*|"'
CH_LEGAL = r'++{}!@#`'
phoenixxl
Newbie
Newbie
Posts: 11
Joined: March 29th, 2012, 6:33 am

Re: OS of the actual folder location. (Stripping illegal cha

Post by phoenixxl »

Mikasa wrote:forking in git
Of course , but i'm hoping for a somewhat more elegant solution that could be implemented in time.
As a stop gap measure , like I indicated in my original message , always stripping for a worst case scenario is fine . Bit in that case I would also hope for that modification to be put in the main trunk. Although branching , modifying then cloning on 4 computers every time a new version comes out isn't all that bad, I vastly prefer using jcfp's ppa. Also , I'm sure I'm not the only one who stumbled on this issue.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: OS of the actual folder location. (Stripping illegal cha

Post by shypike »

phoenixxl wrote:I am not talking about renaming files before processing. I am talking about fixing a system already in place to allow output to network shares of a different OS.
The current system doesn't always work either.
If files are created on a platform that allows character X, it will still fail when downloaded on a platform that doesn't allow X.
For the reasons explained, par2 will override our fixes.
Clean-up could be improved for folder names, but not for file names.
phoenixxl
Newbie
Newbie
Posts: 11
Joined: March 29th, 2012, 6:33 am

Re: OS of the actual folder location. (Stripping illegal cha

Post by phoenixxl »

shypike wrote:Clean-up could be improved for folder names, but not for file names.
Folder names alone would already fix 90% of the issues . There's already the custom length in place that's very handy , I'm sure a "worst case scenario" flag for the stripping of folder names would be doable as an intermediate ? Anything would be appreciated tbh.

Duplicating the issue is simple , install sab on any flavor of linux , mount a network share that is located on a windows machine, configure sab to use folders on that share for temporary and finished downloads. Install the sab plugin for chrome , search "720p" on nz****ex , click advanced search , only display posts by comfun. Click any result using the plugin in chrome. Sab will try to create folders with "(720p|.mkv|h264|aac)" in the name and fail.

Regards.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: OS of the actual folder location. (Stripping illegal cha

Post by shypike »

I'll have a look at what can be done for folder names.
It won't be anything configurable, because that would generate more support
requests instead of less.
phoenixxl
Newbie
Newbie
Posts: 11
Joined: March 29th, 2012, 6:33 am

Re: OS of the actual folder location. (Stripping illegal cha

Post by phoenixxl »

Thank you for having a look.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: OS of the actual folder location. (Stripping illegal cha

Post by shypike »

Will be in 0.7.15
phoenixxl
Newbie
Newbie
Posts: 11
Joined: March 29th, 2012, 6:33 am

Re: OS of the actual folder location. (Stripping illegal cha

Post by phoenixxl »

Thank you , I'm looking forward to it.
Post Reply