Shares: Allow reuse of the same share slugs & tokens #776

This commit is contained in:
Michael Mayer 2020-12-31 12:02:26 +01:00
parent 0c5e00dba7
commit bbd0af3dd3
2 changed files with 2 additions and 2 deletions

View file

@ -39,7 +39,7 @@ func Shares(router *gin.RouterGroup) {
links := entity.FindValidLinks(token, share)
if len(links) != 1 {
if len(links) < 1 {
log.Warn("share: invalid token or share")
c.Redirect(http.StatusTemporaryRedirect, "/")
return

View file

@ -168,7 +168,7 @@ func FindLinks(token, share string) (result Links) {
}
}
if err := q.Find(&result).Error; err != nil {
if err := q.Order("modified_at DESC").Find(&result).Error; err != nil {
log.Errorf("link: %s (not found)", err)
}