feat: direct file link

This commit is contained in:
Elias Schneider
2023-01-31 15:22:08 +01:00
parent cd9d828686
commit 008df06b5c
11 changed files with 144 additions and 25 deletions

View File

@@ -26,10 +26,12 @@ export class ShareTokenSecurity implements CanActivate {
include: { security: true },
});
const isExpired =
moment().isAfter(share.expiration) && !moment(share.expiration).isSame(0);
if (!share || isExpired) throw new NotFoundException("Share not found");
if (
!share ||
(moment().isAfter(share.expiration) &&
!moment(share.expiration).isSame(0))
)
throw new NotFoundException("Share not found");
return true;
}