mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-22 16:33:17 +00:00
Revert workaround for Netatalk long file name bug, since the bug was fixed in Netatalk itself. (#629)
This commit is contained in:
parent
cb2553a9eb
commit
2a47924a74
@ -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"]:
|
||||
|
Loading…
Reference in New Issue
Block a user