Browse Source

Fix path handling of meta descriptions of public pages

pull/8369/head
Thomas Kaul 4 weeks ago
parent
commit
f28bfa2772
  1. 2
      apps/api/src/middlewares/html-template.middleware.ts
  2. 6
      apps/api/src/services/i18n/i18n.service.ts

2
apps/api/src/middlewares/html-template.middleware.ts

@ -201,7 +201,7 @@ export class HtmlTemplateMiddleware implements NestMiddleware {
}
public use(request: Request, response: Response, next: NextFunction) {
const path = request.originalUrl.replace(/\/$/, '');
const path = request.originalUrl.split('?')[0].replace(/\/$/, '');
let languageCode = path.substr(1, 2);
if (

6
apps/api/src/services/i18n/i18n.service.ts

@ -30,13 +30,13 @@ export class I18nService implements OnModuleInit {
const match = link.match(I18nService.TRANSLATION_TAGGED_MESSAGE_REGEX);
const segment = match
? (this.getTranslation({
? this.getTranslation({
languageCode,
id: match.groups.id
}) ?? match.groups.message)
}) || match.groups.message
: link;
return segment.replace(/^\/+|\/+$/, '');
return segment.replace(/^\/+|\/+$/g, '');
});
}

Loading…
Cancel
Save