From 7fb818d4cef09dd74f9fcfd99381a7c0e7064a56 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 6 Oct 2016 16:44:41 -0400 Subject: PLT-3105 Fixed bugs with FileInfos migration, including duplicate FileInfos being saved (#4134) * Added a limit to GetByPath for the rare cases when two old files had the same path * Fixed files still being displayed for deleted posts * Added a lock to prevent migrateFilenamesToFileInfos from migrating multiple posts at once --- store/sql_file_info_store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'store/sql_file_info_store.go') diff --git a/store/sql_file_info_store.go b/store/sql_file_info_store.go index 5c3f6b1a4..78c36c08a 100644 --- a/store/sql_file_info_store.go +++ b/store/sql_file_info_store.go @@ -101,7 +101,8 @@ func (fs SqlFileInfoStore) GetByPath(path string) StoreChannel { FileInfo WHERE Path = :Path - AND DeleteAt = 0`, map[string]interface{}{"Path": path}); err != nil { + AND DeleteAt = 0 + LIMIT 1`, map[string]interface{}{"Path": path}); err != nil { result.Err = model.NewLocAppError("SqlFileInfoStore.GetByPath", "store.sql_file_info.get_by_path.app_error", nil, "path="+path+", "+err.Error()) } else { result.Data = info -- cgit v1.2.3-1-g7c22