From 2a47924a7480160cdd5667fed40f61c16d97994c Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Thu, 3 Feb 2022 17:37:58 -0800 Subject: [PATCH] Revert workaround for Netatalk long file name bug, since the bug was fixed in Netatalk itself. (#629) --- python/web/src/web.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/python/web/src/web.py b/python/web/src/web.py index 00d73677..f441bc32 100644 --- a/python/web/src/web.py +++ b/python/web/src/web.py @@ -6,7 +6,6 @@ import logging import argparse from pathlib import Path from functools import wraps -from hashlib import md5 from flask import ( Flask, @@ -801,17 +800,6 @@ def download_afp(): """ url = request.form.get("url") file_name = Path(url).name - # Shorten file names longer than 31 chars, the HFS upper limit - # Append a hash of the removed piece of the file name to make it unique - # The format of the hash is a # followed by the first four symbols of the md4 hash - if len(file_name) > 31: - chars_to_cut = len(file_name) - 31 - file_name_stem = Path(file_name).stem - file_name_suffix = Path(file_name).suffix - discarded_portion = file_name_stem[:-abs(chars_to_cut)] - stem_remainder = file_name_stem[:(26 - len(file_name_suffix))] - appendix_hash = (md5(discarded_portion.encode("utf-8"))).hexdigest().upper() - file_name = stem_remainder + "#" + appendix_hash[:4] + file_name_suffix process = file_cmds.download_to_dir(url, AFP_DIR, file_name) process = ReturnCodeMapper.add_msg(process) if process["status"]: