Skip to content

Instantly share code, notes, and snippets.

View tlebel's full-sized avatar

Tommy Lebel tlebel

View GitHub Profile
@tlebel
tlebel / design_docke_template.md
Created April 3, 2019 18:42
Design Doc Template

Design Doc Title

Stakeholders

List stakeholders for project/feature.

Role Person
Dev Owner
Other Dev 1 (Engine)
@tlebel
tlebel / get_content_disposition.py
Created July 10, 2012 20:20
Encode HTTP content-disposition filename in base64 or URL Encode
from django.utils.encoding import iri_to_uri
import base64, math
def __get_content_disposition(request, nom_fichier):
"""
Permet de générer la bonne chaine de caractère, selon le navigateur représentant le nom du fichier
"""
if "Firefox/" in request.META['HTTP_USER_AGENT'] or "Chrome/" in request.META['HTTP_USER_AGENT']:
# FF et Chrome: aiment le format base64 splitté en petits blocs
# attachment; filename="=?UTF-8?B?VW4gZmljaGllciBzcMOpY2lhbCBhdmVjIGFjY2VudCBtYWlzIA==?= =?UTF-8?B?YXZlYyB1biB0csOocyBsb25nIG5vbSBkZSBmaWNoaWVyLnR4dA==?="