Skip to content

Commit

Permalink
FIX: compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzay-G committed May 15, 2021
1 parent e0453db commit b2e68e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions archivy/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def create(contents, title, path=""):
"""
filename = secure_filename(title)
data_dir = get_data_dir()
max_filename_length = os.pathconf(str(data_dir), "PC_NAME_MAX")
if len(filename) > max_filename_length:
filename = filename[0:max_filename_length]
max_filename_length = 255
if len(filename + ".md") > max_filename_length:
filename = filename[0:max_filename_length - 3]
path_to_md_file = data_dir / path.strip("/") / f"{filename}.md"
with open(path_to_md_file, "w", encoding="utf-8") as file:
file.write(contents)
Expand Down

0 comments on commit b2e68e1

Please sign in to comment.