MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / Valid

Method Valid

internal/model/sharing.go:26–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26func (s *Sharing) Valid() bool {
27 if s.Disabled {
28 return false
29 }
30 if s.MaxAccessed > 0 && s.Accessed >= s.MaxAccessed {
31 return false
32 }
33 if len(s.Files) == 0 {
34 return false
35 }
36 if s.Creator == nil || !s.Creator.CanShare() {
37 return false
38 }
39 if s.Expires != nil && !s.Expires.IsZero() && s.Expires.Before(time.Now()) {
40 return false
41 }
42 return true
43}
44
45func (s *Sharing) Verify(pwd string) bool {
46 return s.Pwd == "" || s.Pwd == pwd

Callers 8

archiveMetaFunction · 0.80
archiveListFunction · 0.80
linkFunction · 0.80
getFunction · 0.80
listFunction · 0.80
TestIssue5880Function · 0.80
SharingDownFunction · 0.80
SharingArchiveExtractFunction · 0.80

Calls 2

CanShareMethod · 0.80
NowMethod · 0.65

Tested by 1

TestIssue5880Function · 0.64