diff options
author | Erik Johnston <erik@matrix.org> | 2015-07-03 11:26:06 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-07-03 11:26:06 +0100 |
commit | c0a975cc2e784c497219824b8f1fb5a757ba4606 (patch) | |
tree | 78f7cef9678e1e6d12f72d8de988443c8a72fb5a /synapse/util/stringutils.py | |
parent | Oops: underride rule had an identifier with override in it. (diff) | |
parent | If user supplies filename in URL when downloading from media repo, use that n... (diff) | |
download | synapse-c0a975cc2e784c497219824b8f1fb5a757ba4606.tar.xz |
Merge pull request #195 from matrix-org/erikj/content_disposition
Add Content-Disposition headers to media repo downloads
Diffstat (limited to 'synapse/util/stringutils.py')
-rw-r--r-- | synapse/util/stringutils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/util/stringutils.py b/synapse/util/stringutils.py index 52e66beaee..7a1e96af37 100644 --- a/synapse/util/stringutils.py +++ b/synapse/util/stringutils.py @@ -33,3 +33,12 @@ def random_string_with_symbols(length): return ''.join( random.choice(_string_with_symbols) for _ in xrange(length) ) + + +def is_ascii(s): + try: + s.encode("ascii") + except UnicodeDecodeError: + return False + else: + return True |