mirror of
https://github.com/JustKato/FreePad.git
synced 2026-02-23 15:50:46 +02:00
+ Maximum pad length
+ Configurable maximum pad length + Refresh pad + Archive pad + Archives in local client storage + Download pad
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package objects
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/JustKato/FreePad/lib/helper"
|
||||
)
|
||||
|
||||
type Post struct {
|
||||
@@ -73,6 +76,11 @@ func GetPost(fileName string) Post {
|
||||
|
||||
func WritePost(p Post) error {
|
||||
|
||||
maximumPadSize := helper.GetMaximumPadSize()
|
||||
if len(p.Content) > maximumPadSize {
|
||||
return errors.New("The pad is too big, please limit to the maximum of " + fmt.Sprint(maximumPadSize) + " characters")
|
||||
}
|
||||
|
||||
// Get the base storage directory and make sure it exists
|
||||
storageDir := getStorageDirectory()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user