Skip to content

Commit

Permalink
Shares: Allow reuse of the same share slugs & tokens photoprism#776
Browse files Browse the repository at this point in the history
  • Loading branch information
lastzero committed Dec 31, 2020
1 parent 0c5e00d commit bbd0af3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/api/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/entity/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit bbd0af3

Please sign in to comment.