feat: fileshare custom password support (#2493)

* feat: fileshare custom password support

* fix: blank password check

* feat: backend share link password check

* Revert "feat: backend share link password check"

This reverts commit 22c7bb0b355235b48b29938eb995b3986b1122f1.

* feat: use go-playground/validator binding rule
This commit is contained in:
WintBit
2025-06-16 16:34:47 +08:00
committed by GitHub
parent 40644f5234
commit 9d28fde00c
3 changed files with 8 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ type (
ShareCreateService struct {
Uri string `json:"uri" binding:"required"`
IsPrivate bool `json:"is_private"`
Password string `json:"password" binding:"max=32,alphanum,omitempty"`
RemainDownloads int `json:"downloads"`
Expire int `json:"expire"`
ShareView bool `json:"share_view"`
@@ -52,6 +53,7 @@ func (service *ShareCreateService) Upsert(c *gin.Context, existed int) (string,
share, err := m.CreateOrUpdateShare(c, uri, &manager.CreateShareArgs{
IsPrivate: service.IsPrivate,
Password: service.Password,
RemainDownloads: service.RemainDownloads,
Expire: expires,
ExistedShareID: existed,