Revert workaround for Netatalk long file name bug, since the bug was fixed in Netatalk itself. (#629)

This commit is contained in:
Daniel Markstedt 2022-02-03 17:37:58 -08:00 committed by GitHub
parent cb2553a9eb
commit 2a47924a74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 12 deletions

View File

@ -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"]: