Compare commits

...

2 Commits

Author SHA1 Message Date
Elias Schneider
7a387d86d6 release: 0.20.3 2023-11-17 15:27:31 +01:00
Elias Schneider
330eef51e4 fix: max expiration gets ignored if expiration is set to "never" 2023-11-17 15:27:22 +01:00
10 changed files with 27 additions and 14 deletions

View File

@@ -1,3 +1,10 @@
## [0.20.3](https://github.com/stonith404/pingvin-share/compare/v0.20.2...v0.20.3) (2023-11-17)
### Bug Fixes
* max expiration gets ignored if expiration is set to "never" ([330eef5](https://github.com/stonith404/pingvin-share/commit/330eef51e4f3f3fb29833bc9337e705553340aaa))
## [0.20.2](https://github.com/stonith404/pingvin-share/compare/v0.20.1...v0.20.2) (2023-11-11) ## [0.20.2](https://github.com/stonith404/pingvin-share/compare/v0.20.1...v0.20.2) (2023-11-11)

View File

@@ -1,12 +1,12 @@
{ {
"name": "pingvin-share-backend", "name": "pingvin-share-backend",
"version": "0.20.2", "version": "0.20.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pingvin-share-backend", "name": "pingvin-share-backend",
"version": "0.20.2", "version": "0.20.3",
"dependencies": { "dependencies": {
"@nestjs/cache-manager": "^2.1.0", "@nestjs/cache-manager": "^2.1.0",
"@nestjs/common": "^10.1.2", "@nestjs/common": "^10.1.2",

View File

@@ -1,6 +1,6 @@
{ {
"name": "pingvin-share-backend", "name": "pingvin-share-backend",
"version": "0.20.2", "version": "0.20.3",
"scripts": { "scripts": {
"build": "nest build", "build": "nest build",
"dev": "cross-env NODE_ENV=development nest start --watch", "dev": "cross-env NODE_ENV=development nest start --watch",

View File

@@ -19,7 +19,6 @@ export class ShareOwnerGuard extends JwtGuard {
} }
async canActivate(context: ExecutionContext) { async canActivate(context: ExecutionContext) {
const request: Request = context.switchToHttp().getRequest(); const request: Request = context.switchToHttp().getRequest();
const shareId = Object.prototype.hasOwnProperty.call( const shareId = Object.prototype.hasOwnProperty.call(
request.params, request.params,

View File

@@ -54,10 +54,15 @@ export class ShareService {
} else { } else {
const parsedExpiration = parseRelativeDateToAbsolute(share.expiration); const parsedExpiration = parseRelativeDateToAbsolute(share.expiration);
const expiresNever = moment(0).toDate() == parsedExpiration;
if ( if (
this.config.get("share.maxExpiration") !== 0 && this.config.get("share.maxExpiration") !== 0 &&
parsedExpiration > (expiresNever ||
moment().add(this.config.get("share.maxExpiration"), "hours").toDate() parsedExpiration >
moment()
.add(this.config.get("share.maxExpiration"), "hours")
.toDate())
) { ) {
throw new BadRequestException( throw new BadRequestException(
"Expiration date exceeds maximum expiration date", "Expiration date exceeds maximum expiration date",

View File

@@ -1,12 +1,12 @@
{ {
"name": "pingvin-share-frontend", "name": "pingvin-share-frontend",
"version": "0.20.2", "version": "0.20.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pingvin-share-frontend", "name": "pingvin-share-frontend",
"version": "0.20.2", "version": "0.20.3",
"dependencies": { "dependencies": {
"@emotion/react": "^11.11.1", "@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0", "@emotion/server": "^11.11.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "pingvin-share-frontend", "name": "pingvin-share-frontend",
"version": "0.20.2", "version": "0.20.3",
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",

View File

@@ -12,7 +12,7 @@ const showShareInformationsModal = (
modals: ModalsContextProps, modals: ModalsContextProps,
share: MyShare, share: MyShare,
appUrl: string, appUrl: string,
maxShareSize: number maxShareSize: number,
) => { ) => {
const t = translateOutsideContext(); const t = translateOutsideContext();
const link = `${appUrl}/s/${share.id}`; const link = `${appUrl}/s/${share.id}`;

View File

@@ -125,11 +125,13 @@ const CreateUploadModalBody = ({
"", "",
) as moment.unitOfTime.DurationConstructor, ) as moment.unitOfTime.DurationConstructor,
); );
if ( if (
options.maxExpirationInHours != 0 && options.maxExpirationInHours != 0 &&
expirationDate.isAfter( (form.values.never_expires ||
moment().add(options.maxExpirationInHours, "hours"), expirationDate.isAfter(
) moment().add(options.maxExpirationInHours, "hours"),
))
) { ) {
form.setFieldError( form.setFieldError(
"expiration_num", "expiration_num",

View File

@@ -1,6 +1,6 @@
{ {
"name": "pingvin-share", "name": "pingvin-share",
"version": "0.20.2", "version": "0.20.3",
"scripts": { "scripts": {
"format": "cd frontend && npm run format && cd ../backend && npm run format", "format": "cd frontend && npm run format && cd ../backend && npm run format",
"lint": "cd frontend && npm run lint && cd ../backend && npm run lint", "lint": "cd frontend && npm run lint && cd ../backend && npm run lint",