Fix: Improve filename sanitization to prevent Windows 8.3 short names on Synology

This commit is contained in:
2026-01-06 23:36:11 +09:00
parent 92276396ce
commit f2aa78fa48
2 changed files with 16 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
title: "애니 다운로더" title: "애니 다운로더"
version: "0.5.39" version: "0.5.40"
package_name: "anime_downloader" package_name: "anime_downloader"
developer: "projectdx" developer: "projectdx"
description: "anime downloader" description: "anime downloader"

View File

@@ -58,11 +58,21 @@ class Util(object):
@staticmethod @staticmethod
def change_text_for_use_filename(text): def change_text_for_use_filename(text):
# text = text.replace('/', '') # 1. Remove/replace Windows-forbidden characters
# 2021-07-31 X:X text = re.sub('[\\/:*?"<>|]', ' ', text)
# text = text.replace(':', ' ')
text = re.sub('[\\/:*?\"<>|]', ' ', text).strip() # 2. Remove consecutive dots (.. → .)
text = re.sub("\s{2,}", ' ', text) text = re.sub(r'\.{2,}', '.', text)
# 3. Remove leading/trailing dots and spaces
text = text.strip('. ')
# 4. Collapse multiple spaces to single space
text = re.sub(r'\s{2,}', ' ', text)
# 5. Remove any remaining trailing dots (after space collapse)
text = text.rstrip('.')
return text return text
@staticmethod @staticmethod