mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: add memo content length limit setting
This commit is contained in:
@@ -123,6 +123,11 @@ func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.Worksp
|
||||
return workspaceGeneralSetting, nil
|
||||
}
|
||||
|
||||
const (
|
||||
// DefaultContentLengthLimit is the default limit of content length in bytes. 8KB.
|
||||
DefaultContentLengthLimit = 8 * 1024
|
||||
)
|
||||
|
||||
func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.WorkspaceMemoRelatedSetting, error) {
|
||||
workspaceSetting, err := s.GetWorkspaceSetting(ctx, &FindWorkspaceSetting{
|
||||
Name: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED.String(),
|
||||
@@ -135,6 +140,9 @@ func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.Wo
|
||||
if workspaceSetting != nil {
|
||||
workspaceMemoRelatedSetting = workspaceSetting.GetMemoRelatedSetting()
|
||||
}
|
||||
if workspaceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
|
||||
workspaceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
|
||||
}
|
||||
return workspaceMemoRelatedSetting, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user