summaryrefslogtreecommitdiffstats
path: root/store/sql_file_info_store.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-10-06 16:44:41 -0400
committerenahum <nahumhbl@gmail.com>2016-10-06 17:44:41 -0300
commit7fb818d4cef09dd74f9fcfd99381a7c0e7064a56 (patch)
tree0f79dd96a91420f4a4fa377ecc900deeb084416a /store/sql_file_info_store.go
parentc9793a566a4f425997448a742b16ed8754c17bae (diff)
downloadchat-7fb818d4cef09dd74f9fcfd99381a7c0e7064a56.tar.gz
chat-7fb818d4cef09dd74f9fcfd99381a7c0e7064a56.tar.bz2
chat-7fb818d4cef09dd74f9fcfd99381a7c0e7064a56.zip
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
Diffstat (limited to 'store/sql_file_info_store.go')
-rw-r--r--store/sql_file_info_store.go3
1 files changed, 2 insertions, 1 deletions
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