Skip to content
Snippets Groups Projects
Commit f982fa45 authored by Semyon Krestyaninov's avatar Semyon Krestyaninov :dog2:
Browse files

fix

parent 015b4813
No related branches found
No related tags found
No related merge requests found
...@@ -134,12 +134,7 @@ func (t FileType) PreSave(ctx context.Context, _ *field.Field, v interface{}, _ ...@@ -134,12 +134,7 @@ func (t FileType) PreSave(ctx context.Context, _ *field.Field, v interface{}, _
return nil, false, nil return nil, false, nil
} }
// Пропускаем, если файл уже постоянный. // Помечаем файл как постоянный.
if !f.Temporary {
return f, false, nil
}
// Помечаем временный файл как постоянный.
updated, err := t.fs.UpdateFile(ctx, f.ID, &UpdateFileRequest{ updated, err := t.fs.UpdateFile(ctx, f.ID, &UpdateFileRequest{
Temporary: optional.False, Temporary: optional.False,
}) })
...@@ -147,7 +142,9 @@ func (t FileType) PreSave(ctx context.Context, _ *field.Field, v interface{}, _ ...@@ -147,7 +142,9 @@ func (t FileType) PreSave(ctx context.Context, _ *field.Field, v interface{}, _
return nil, false, errors.Wrap(err, "update file") return nil, false, errors.Wrap(err, "update file")
} }
return updated, true, nil changed := f.Temporary != updated.Temporary
return updated, changed, nil
} }
// Field - создает новое поле Field типа FileType // Field - создает новое поле Field типа FileType
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment