@@ -385,12 +385,10 @@ def remove_session(session_id):
385385 # logger.info("Session %s removed", session_id)
386386
387387
388- def get_file_download_url (uid , separator = "-" , block_size = 5 , root_url = None , short_uid = None ):
388+ def get_file_download_url (uid , root_url = None , short_uid = None ):
389389 """Get the file download URL for a given file UID.
390390
391391 :param uid: file UID
392- :param separator: separator used in short UID encoding
393- :param block_size: block size used in short UID encoding
394392 :param root_url: root URL. If not provided, the settings value is used
395393 :param short_uid: take this short UID instead of computing it
396394 :return: file download URL, short_uid
@@ -401,7 +399,7 @@ def get_file_download_url(uid, separator="-", block_size=5, root_url=None, short
401399 if not root_url :
402400 raise Exception ("No root URL provided for file download url." )
403401 if not short_uid :
404- short_uid = shortuid_encode_id (uid , separator = separator , block_size = block_size )
402+ short_uid = get_suid_from_uuid (uid )
405403 return "{}/{}" .format (root_url .strip ('/' ), short_uid ), short_uid
406404
407405
@@ -416,3 +414,12 @@ def get_max_download_date(obj, delta=timedelta(days=90), adate=None):
416414 if adate is None :
417415 adate = obj .modified ().asdatetime ().date ()
418416 return adate + delta
417+
418+
419+ def get_suid_from_uuid (uid ):
420+ """Get the short UID from a given UUID.
421+
422+ :param uid: UUID
423+ :return: short UID
424+ """
425+ return shortuid_encode_id (uid , separator = "-" , block_size = 5 )
0 commit comments