mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
fixed a bug in file contributors
This commit is contained in:
13
utils.py
13
utils.py
@@ -377,8 +377,17 @@ def get_file_contributors(repo_id, file_path, file_path_hash, file_id):
|
||||
contributors = []
|
||||
last_modified = 0
|
||||
try:
|
||||
fc = FileContributors.objects.get(repo_id=repo_id,
|
||||
file_path_hash=file_path_hash)
|
||||
# HACK: Fixed the unique key bug in 1.1
|
||||
# Should be removed in future
|
||||
fc = FileContributors.objects.filter(repo_id=repo_id,
|
||||
file_path_hash=file_path_hash)
|
||||
if not fc:
|
||||
raise FileContributors.DoesNotExist
|
||||
else:
|
||||
if len(fc) > 1:
|
||||
for e in fc[1:]:
|
||||
e.delete()
|
||||
fc = fc[0]
|
||||
except FileContributors.DoesNotExist:
|
||||
# has no cache yet
|
||||
contributors, last_modified = get_file_contributors_from_revisions (repo_id, file_path)
|
||||
|
Reference in New Issue
Block a user