casualsnek / onthespot

qt based music downloader written in python
GNU General Public License v2.0
741 stars 53 forks source link

fix(spotify.py): sanitize "dot" #52

Closed calvin-li-developer closed 1 year ago

calvin-li-developer commented 1 year ago

This can fail on windows to have dots at the end of an album such as "John Smith..." or anything in between.

casualsnek commented 1 year ago

Can you change it a little bit ?

From Here

Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".

User can have dot (.) in filenames or directory names as long as it does not end with dot ! I think we can do this better this way

if os.name == 'nt':
    value = value.replace('|', '-')
    value = value.rstrip('.')

This should remove all dots at the end of filename in windows system while allowing dots to be used in other positions !

calvin-li-developer commented 1 year ago

Changed.