You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2018/09/20 20:21:47 UTC
[2/2] allura git commit: [#6560] Append random number for duplicate
image filename
[#6560] Append random number for duplicate image filename
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/3afec2c0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/3afec2c0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/3afec2c0
Branch: refs/heads/master
Commit: 3afec2c085c525bf7c044aaf37ee050ec07eee6a
Parents: 5ad16d6
Author: Shalitha <sh...@gmail.com>
Authored: Thu Sep 20 20:00:15 2018 +0530
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Sep 20 20:20:51 2018 +0000
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/3afec2c0/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 247a55b..aaa480d 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -17,6 +17,7 @@
import logging
import re
+from random import randint
from collections import OrderedDict
from datetime import datetime
from urlparse import urlparse
@@ -517,6 +518,10 @@ class ProjectAdminController(BaseController):
flash('You may not have more than 6 screenshots per project.',
'error')
elif screenshot is not None and screenshot != '':
+ for screen in screenshots:
+ if screen.filename == screenshot.filename:
+ screenshot.filename = re.sub('(.*)\.(.*)', r'\1-' + str(randint(1000,9999)) + r'.\2', screenshot.filename)
+ break
M.AuditLog.log('add screenshot')
sort = 1 + max([ss.sort or 0 for ss in screenshots] or [0])
M.ProjectFile.save_image(