From 4acb118268f4fd21f88ae8edbb178e1249054eb3 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Mon, 15 Oct 2018 16:35:20 +0200 Subject: [PATCH] [Printer] Handles accentted filenames --- apt_requirements.txt | 1 + printer/utils.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apt_requirements.txt b/apt_requirements.txt index c33fe7fb..98c13818 100644 --- a/apt_requirements.txt +++ b/apt_requirements.txt @@ -19,3 +19,4 @@ graphviz git poppler-utils texlive-extra-utils +python3-unidecode diff --git a/printer/utils.py b/printer/utils.py index 91b7e669..658c3bb0 100644 --- a/printer/utils.py +++ b/printer/utils.py @@ -1,5 +1,7 @@ +# -*- coding: utf-8 -*- import subprocess import os +import unidecode def user_printing_path(instance, filename): """ @@ -7,7 +9,7 @@ def user_printing_path(instance, filename): Currently MEDIA_ROOT/printings/user_/ """ # File will be uploaded to MEDIA_ROOT/printings/user_/ - return 'printings/user_{0}/{1}'.format(instance.user.id, filename) + return 'printings/user_{0}/{1}'.format(instance.user.id, unidecode.unidecode(filename))